Same HTML, Different CSS

Ahmad Shadeed walks through the idea of a card component built from a fixed set of semantic HTML carrying some BEM-style classes — title, author, image, and tags. He then redesigns that card into five completely different layouts while leaving the markup untouched and changing only the CSS.

If that lands as an ah-ha moment, it's worth noting this exact idea energized an entire generation of front-end developers, thanks in large part to the concept of the CSS Zen Garden, where one fixed set of HTML plus nothing but CSS changes produced a remarkable range of creative designs.

In practice, redesign work usually does mean getting our hands into the HTML. Still, this is a fun exercise that drives home the power of CSS. The question is whether JavaScript-powered components are what deliver that same awe today, since they offer a comparable power of abstraction: change a component and watch the impact ripple across a whole site. The difference is that this abstraction isn't rooted in constraint — there are no constraints.

Direct Link →

CSS-Tricks star logo

Sponsor CSS-Tricks!

We've got lots of ways to help you connect with the greatest front-end community in all the land.