What is the difference | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

What is the difference

what is the difference about: .class .closs{ /*css codes*/ } and .class, .closs{ /*css codes*/ }

8th Sep 2018, 1:51 PM
Jingga Sona
Jingga Sona - avatar
5 Answers
+ 15
the first code select .closs that is a child of .class the second code select both .class and .closs
8th Sep 2018, 2:46 PM
Amethyst Animion
Amethyst Animion - avatar
+ 10
a comma...
8th Sep 2018, 2:38 PM
LONGTIE👔
LONGTIE👔 - avatar
+ 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 ☺️☺️.
8th Sep 2018, 2:49 PM
Meet Mehta
Meet Mehta - avatar
+ 4
Amethyst Animion Meet Mehta Its Helps Me A Lot! Thanks! LONGTIE👔 um..... 😂😂😂😂
9th Sep 2018, 7:27 AM
Jingga Sona
Jingga Sona - avatar
+ 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
10th Sep 2018, 7:51 AM
Rowsej
Rowsej - avatar