+ 5
What is the difference
what is the difference about: .class .closs{ /*css codes*/ } and .class, .closs{ /*css codes*/ }
5 Réponses
+ 15
the first code select .closs that is a child of .class
the second code select both .class and .closs
+ 10
a comma...
+ 5
In first one styles will be applied to only elements ( having class name closs ) that are inside of elements ( having class name class ).
In second one styles will be applied to both element having class name : class and closs.
Hope this helps ☺️☺️.
+ 4
+ 4
The first one selects all elements with .closs which have an ancestor of an element with .class.
The second one selects all .class AND .closs elements.
Also...
.class > .closs will select all .closs that have a direct parent which is a .class.
.class + .closs selects all .closs that come after a .class element, and they both have the same parent. You can use this to make a dropdown, such as this simple code here:
https://code.sololearn.com/W7v5Pmo7E183/?ref=app