I've loved & used data-* attributes liberally in all my projects. They enable better separation of concerns & often more readable markup.

So I agree with the benefits outlined in this post keithcirkel.co.uk/css-classes-, just not with its title.

Use what works for you.

#html #css

Follow

@SaraSoueidan An interesting proposal, but... According to the spec, data attributes are for JS only. On the other hand, we have CSS selectors for them. I think it's good to have options, but I think is best to keep classes for CSS and data for JS as much as it makes sense, in order to keep separation of concerns and be polite to the next poor soul that gets to maintain your code.

Sign in to participate in the conversation
CleverLibre Social

CleverLibre Social is an inclusive social instance for open discussion, learning, and community.
All cultures welcome.
Hate speech and harassment strictly forbidden.