📚 › HTML: build the structure of a web page
10. Attributes: id, class and data
ستتم ترجمة هذا المقال تلقائيًا. يُعرض بالإنجليزية حاليًا.
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.
عرض المثال
<p id="intro" class="note" data-level="easy">Start here.</p>
✍️ دورك الآن
Make a paragraph with id main-text, class highlight, and data-level set to beginner.