11 ms·
This feels like a terrible idea, something totally academic rather than usable. I practice the exact opposite, using classes everywhere, and virtually never att
by crazygringo 14y ago
This feels like a terrible idea, something totally academic rather than usable. I practice the exact opposite, using classes everywhere, and virtually never attaching CSS rules to element names.
This is because, in my real-world experience, HTML structure can change very easily. The h1 turns into an h3 for SEO reasons, a wrapper div gets added for a visual effect, an extra span gets thrown inside an existing one. And suddenly, all the CSS is broken because it all depended on the exact structure of the HTML. Maintenance becomes a nightmare.
But if you do everything with named classes, then nothing breaks at all. Writing CSS without classes makes as much sense to me as writing JavaScript code without function names.
- heydonworks 14y agoWhen the HTML structure changes, the CSS changes in accordance. That is what is supposed to happen. You do not understand the technology.