Shuqi Khor
May 19, 2023

You could, but that doesn't mean that you should.

Data attributes are meant for Javascript to store and read data in the element.

It's like nobody would use img[src="logo.png"] to style a particular element. It works, but it's not meant to be a replacement of ID and Class :)

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Shuqi Khor
Shuqi Khor

Responses (1)

Write a response