Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.



It is not equivalent in any sense. Let's not forget specificity.


If 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: