📚 › HTML: build the structure of a web page
10. Attributes: id, class and data
Este artículo se traducirá automáticamente. Por ahora se muestra en inglés.
An attribute adds information to an element inside its start tag. id gives one element a unique name on the page. class groups elements that share a style. data-* attributes store your own values.
CSS and JavaScript use these attributes to find and change elements.
Ver ejemplo
<p id="intro" class="note" data-level="easy">Start here.</p>
✍️ Ahora te toca
Make a paragraph with id main-text, class highlight, and data-level set to beginner.