0
[HTML] When do I use .class and when do I use #id?
for example, I know that for div elements it is better to use class, <div class="a">...</div> why didn't we use id? why <p id="b"> and not <p class="b">?
2 Antworten
+ 3
Id is used to refference a specific element, whereas class can be used to reference a defined group of elements for example a class of headings where all the headings belong to a specific class. Elements can also belong to more than one class.