+ 7
Still don't get the difference between class and id (not in terms of syntax, but why should i use one instead of another)
pls like 😉😊
5 Réponses
+ 7
because you can use Class in many elements (no repetition of code) and you may need to distinguish elements with ID
+ 5
An id is unique (no elements may have the same id), while several elements may have the same class at the same time. An element may also have multiple classes at once. Think of ids as unique names and classes as categories.
+ 1
ID is for only one element in the page like footer or header... and class is for repeated things like paragraphs etc..
+ 1
thanks a lot all..
+ 1
Use 'id's rarely and mostly classes. It helps you to write less. Practice more and you know what I mean.