Starlit Daily

📚 › 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.

← कोर्स पर वापस