October 25, 2020
Classless is getting classy
HTML has a lot more tags than it used to, but you would never know it from looking at typical source code riddled with divs
, each with its own class.
Why is it rare to see sections
, articles
and asides
? Wouldn’t it be easier to style tags that exist than to create classes for a bunch of divs
? Classes whose names you will undoubtedly forget and have to look up?
On a complex website, there may not be enough tags to cover all the styles you need. But don’t let that stop you from trying. There is a lot you can do.
CSS Bed has proof, with a lost list of classless themes you can click to see how they look. And the looks vary a lot.
More proof comes from Basic.css. It starts off with two responsive rows of three nice looking cards, in a layout typical of Bootstrap. It’s done with flexbox applied to articles
in a section
. This allows for an infinity grid — any number of elements.
Basic.css doesn’t appear to allow for a main/sidebar layout, but it should be possible if you stick with flexbox — or even grid.
Someone (me?) should try it.