0
They say "id" is unique but we can use the same id name to style different elements, so how is it any different than class?
2 ответов
+ 1
Well, if you don't want to follow the standards then you're only "hurting" your self. The rules are there to make life easier for you.
0
If you have the same id for multiple elements you will not pass validation. An id must be unique to an element. Think of it this way; you can style multiple elements the same by using class. But if you want something specific, such as creating a link to a specific section from one page to another, you would want to use id. There are more reasons of course. Here is some great reading material. Go to the section that talks about bar codes and serial numbers. Great comparison https://css-tricks.com/the-difference-between-id-and-class/