+ 2
ID vs Class
In CSS the major difference is that IDs can only be applied once per page, while classes can be used as many times on a page as needed. My question is why? Is that because ID works as a global attribute and class not or smth else in the logic? https://code.sololearn.com/W5HDCnlq0XZ8/?ref=app
2 Respostas
+ 2
Class is used to target various element at a time hence it is common for all if they have similar style to do.
Id is used to target a single element hence it should be different for all.
And class is also a global attribute in html 5.
+ 2
Divya Mohan tnx