0

What is the difference between id and class selectors?

6th Mar 2017, 7:14 PM
Emmanuel Nuotah
2 Respuestas
+ 3
You can only have one element with the same id. Let's say one element has id: top-right-logo. there is only going to be one. You don't need more. If you have a class, for example called: section-title, you are probably gonna use that more times than one.
6th Mar 2017, 7:19 PM
David Koplik
David Koplik - avatar
+ 1
The only difference is the way they're referred to and defined a class selector is reffered to in CSS by a period (.) whereas an id is referred to by a hash sign ( # ) and creating on in HTML for class -> class="class_name", for id id = "id_name"
6th Mar 2017, 7:19 PM
Vesse
Vesse - avatar