4 ms·
How is it better to have only one of something and give it a class that nothing else uses than to use IDs how they're intended?
by jimmaswell 8y ago
How is it better to have only one of something and give it a class that nothing else uses than to use IDs how they're intended?
- LocalPCGuy 8y agoI take issue with your assertion about how IDs "are intended". I think that idea (and CSS being taught that way) is one of the reasons people have trouble with CSS. There are quite a few reasons for preferring to not use IDs, here's two: 1- specificity of IDs always trumping things 2- having to change it from an ID to a class later on if it becomes a reusable item (which in a widget, is almost always the case). There is no reason a class cannot apply to just a single item, where an ID is by its nature limited.