Set your Publisher ID in src/config/ads.ts to display live ads.
HTML Elements & Attributes
Nested elements, empty elements, and HTML attributes
An HTML element usually consists of a start tag, content, and an end tag. All HTML elements can have attributes that provide additional information about the element.
Nested HTML Elements
HTML elements can be nested (elements can contain other elements).
All HTML documents consist of nested HTML elements. For example, <body> contains <h1>, which can contain <span> or text.
<div style="background-color: #f1f5f9; padding: 20px; border-radius: 8px;">
<h2 style="color: #0f172a;">Coding Bootcamp</h2>
<p>Learn <strong>web development</strong> from scratch.</p>
<ul>
<li>HTML5 Structure</li>
<li>CSS3 Styling</li>
<li>Modern JavaScript</li>
</ul>
</div>Common HTML Attributes
Attributes provide additional information about HTML elements.
All HTML elements can have attributes, and they are always specified in the start tag.
Attributes usually come in name/value pairs like name="value".
| Attribute | Applies to | Purpose |
|---|---|---|
| class | Global | Specifies one or more class names for CSS styling and JS selection |
| id | Global | Specifies a unique id for an element across the entire document |
| style | Global | Specifies an inline CSS style for an element |
| title | Global | Specifies extra information about an element (displayed as tooltip) |
| src | <img>, <script>, <iframe> | Specifies the path to the resource to display or load |
| href | <a>, <link> | Specifies the hyperlink target URL |
Set your Publisher ID in src/config/ads.ts to display live ads.
Test Yourself With Exercise
Which global HTML attribute assigns a UNIQUE identifier to an element?