loading...

re: Reasons not to use IDs in CSS VIEW POST

FULL DISCUSSION
 

I don't understand. I'm just a beginner and I think it's great to use classes for things which have the same CSS rules applied to them, and IDs for a rule that will only be applied to one element. I see nos. 1 and 2 if not as advantages for IDs over classes, at least an equal. If I see a class, I can immediately assume other elements have the same class and to be careful when altering it, but I can be sure altering an ID rule will have no unexpected side-effects. What you describe as consistency I see as ambiguity. Using IDs gives more explicit information to a developer, making it easier to understand the nature of my CSS.

Please make a follow up article explaining why using only classes is better. I still think using a combination of IDs and classes has benefits.

Code of Conduct Report abuse