-
This is a very thoughtful post on different ways of thinking about semantic vs style-oriented markup and stylesheets from adamwathan. Theoretically, I really like purely semantic markup, but agree with all of his points about interdependence, consistency, and reuse.
-
It seems to me that the line between semantics and style is pretty fuzzy. What makes a <ul> list a component worthy of a semantic tag, but “card” is a style? So to me, Adam’s phase 3 (content-agnostic components) can be just about as semantic as “purely” semantic markup.
-
Where I’m at now is trying to address the reusability and consistency problems by defining typography, color, and spacing palettes as variables and mixins, then building “component” classes by picking from those palettes and adding component-specific layout or other properties.
-
This keeps purely presentational utility classes (like
align-right) out of the markup, but component styles can still be built up from a similarly consistent set of variables and mixins. -
(Sorry, this UX designer is currently on a front-end engineering kick)
-
forgot attachment 📎 adamwathan.me/css-utility-classes-and-separation-of-concerns/