+ 3

WEB->CSS: To "ID," or NOT to "ID"…that is the question. No, actually, it really is my question.

We pretty much all know (if you have even an inkling of CSS knowledge, you know) that as far as selectors, all but one, for the most part, have no limits. It states that ID (#) Selectors may be used ONCE per page. Ok, we get that, right? Sure. And yet I see, quite often, actually, several ID="suchAndSuch"; ID="andSoOn"; and ID="andSoForth"; and even ID="areWeMultiplying" and ID="youGetMyPoint" ; What the Flip-Flop is going on here? How/WHY is this allowed? Please help me, and Thank you in advance. Michael

1st Feb 2018, 3:35 PM
Michael
Michael - avatar
3 Réponses
+ 6
No, if I remember correctly the rule is that an ID must be unique. So having multiple ID's is allowed, if they are unique.
1st Feb 2018, 5:53 PM
The Coding Sloth
The Coding Sloth - avatar
0
Id should be unique... if you are making more than one id than they should have unique names...
2nd Feb 2018, 3:34 PM
Harshit Gupta
Harshit Gupta - avatar
0
Every ID is unique for such elements and two elements can not have same ID. (If they could, there would be identity crisis.)
7th Jun 2018, 12:54 PM
Arda Aydın
Arda Aydın - avatar