Using Data-Attributes (data-*) in CSS

We can store extra information about elements using data-* attribute. The following examples illustrate CSS data-* attribute.

Example






Tea
Hot Spicy Tea or Ice Lemon Tea
Toast
Hot Garlic Butter Toast

(hover over food item)

Output

This will produce the following result ?

Example






Demo Text

Output

This will produce the following result ?

Updated on: 2026-03-11T22:50:56+05:30

1K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements