An interesting article¹ by
@keithamus on "CSS Classes Considered Harmful"
I went into the article skeptical, but found myself coming around to the POV that data-attributes offer significant advantages over a class="…" grab-bag.
However, it was unfortunate that most of the examples go down a non-semantic route, doing things like
data-align=left
or
data-border-collapse~="top"
which push the style decisions into the HTML rather than leaving the HTML to define the *structure*, and letting the CSS to decide the *appearance*. Especially since this data-attribute method is great for facilitating this separation.
tl;dr: use data-attributes rather than classes, could better examples
⸻
¹ https://www.keithcirkel.co.uk/css-classes-considered-harmful/
