Thursday, September 28, 2017

adjacent sibling combinator in CSS

If there is a section tag immediately followed by an article tag then both tags will be colored red by this:

section + article {
   background-color: red;
}

 
 

I have kind of already touched on this here but one thing new I will add is that I there does not seem to be a way to do a cascading effect with an adjacent sibling combinator. While...

article select {

 
 

...would affect just the select tags inside of an article tag. There does not seem to be a way to have something like...

(section + article) select {

 
 

...if you get my drift. Lame!

No comments:

Post a Comment