HTML basics: Data attributes
data-* attributes store page-specific information without pretending that it is visible text or a standard HTML behavior.
Current edit
Understand the pattern
data-* attributes store page-specific information without pretending that it is visible text or a standard HTML behavior.
data-* attributes store page-specific information without pretending that it is visible text or a standard HTML behavior.
Misconceptions to reject
- A visual appearance alone guarantees the intended HTML meaning.
- Replacing semantic elements with generic divs automatically improves accessibility.
The preview is a sanitized subset, not a full browser compatibility test.
Worked example and expected result
<article data-lesson="log-review" data-level="beginner"><h1>Log review</h1><p>Inspect a short incident log.</p></article>data-* attributes store page-specific information without pretending that it is visible text or a standard HTML behavior.
Explain it
Apply it elsewhere
Keep the momentum.
Complete the lab, then explain and apply the pattern.
Next: HTML basics: Reusable class namesTry an incident drillAnonymous lesson and mastery progress lasts for this session. Sign in to keep synced lesson XP between sessions; mastery stays device-local. No speed bonus, lost lives, or hint penalties.