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

¹ keithcirkel.co.uk/css-classes-

0

If you have a fediverse account, you can quote this note from your own instance. Search https://mastodon.bsd.cafe/users/gumnos/statuses/114695189521726604 on your instance and quote it. (Note that quoting is not supported in Mastodon.)