4 ms·
Exactly, as far as CSS is concerned an id is effectively equivalent to a class name except when it breaks things. Ids should be used only for scripts, and most
by kinofcain 16y ago
Exactly, as far as CSS is concerned an id is effectively equivalent to a class name except when it breaks things.
Ids should be used only for scripts, and most of the time should be auto generated anyway.
- rimantas 16y agoIt is not equivalent in any sense. Let's not forget specificity.
- kinofcain 16y agoIf you're relying on weird specificity chains, then your CSS is likely an unmaintainable mess. Leave IDs for uniquely identifying an element on a page because you need to access it from a script. Treating them like "Extra Strong" class names is a maintenance nightmare.