← BYTES
HTML·Intermediate·Ref: 2.2.9
What are HTML5 `data-*` custom attributes used for?
Have a question about this video? Mention reference 2.2.9 when you contact us.
a.They are reserved exclusively for the browser's own internal use and cannot be read by developers
b.They can only hold numeric values, never strings
c.They let you store arbitrary custom data directly on an HTML element (e.g., data-user-id="42"), readable and writable from CSS and JavaScript (via the element's dataset property), without needing non-standard or invalid attributes
d.They are automatically synchronized with a backend database
data-* attributes provide a standards-compliant way to attach custom metadata to any HTML element -- JavaScript can read/write them via element.dataset.userId (automatically converting the kebab-case attribute name to camelCase), and CSS can even select or display them via attr() in some contexts, avoiding the old anti-pattern of smuggling data into non-standard or invalid attribute names.
Find this on YouTube & Instagram
Every BYTES video is tagged with its reference number and topic — search any of these on YouTube or Instagram to find this one:
#BYTES#BYTES229#HTML