h1.class vs .class h1 | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 1

h1.class vs .class h1

Are they essentially the same thing? Why should I use one vs the other? Any help would be greatly appreciated! :)

17th Dec 2017, 4:54 PM
3 Antworten
+ 1
If you're talking about the css selector h1.class means the all elements h1 that have the class called "class" (in this case) .class h1 means, all h1 elements inside elements that contain the class "class" You can stack elements to select meticulously, for example: section#main:nth-child(7) span.highlight the line above looks for a span that contains the class highlight, which is inside the seventh element inside the section whose id is "main". But instead you should use just span.highlight unless you have many, and want to select only one, or a selected few
17th Dec 2017, 5:49 PM
in fact there is no difference here, to be honest, you're right! :)
17th Dec 2017, 5:07 PM
James16 - avatar
17th Dec 2017, 5:33 PM
ßáîßáîBrains[Abidemi] - avatar