Monday, 15 August 2016

Selecting more that one class in css 3




Today I was looking at some sample code I found and noticed that the developer used a "+" instead of a "," to select two classes.



.region + .region{
border-left: 1px solid lightgray;
padding-left: 3.5%;
margin-left: 4%;
}



What does the "+" sign do that the "," doesn't? Why would you use it? curiously the same class was selected twice here. Why?



Here is a link to the code pen... http://codepen.io/adobe/pen/vKixh



Im just learning CSS3 and any help would be appreciated. Thanks


Answer













using .c + div {} will style "x" CSS ONLY WORKS DOWNWARDS!












using .c, .x {} will style both "c" and "x" the same way.













using .c.x {} will style "c x"


No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...