HTML Elements
HTML elements are the building blocks of a web page. They are defined by tags, which are enclosed in angle brackets.
Common HTML Tags
<h1>
to<h6>
: Headings<p>
: Paragraph<a>
: Anchor (Hyperlink)<img>
: Image<div>
: Division or Section<span>
: Inline container for text<ul>
and<ol>
: Unordered and Ordered Lists<li>
: List Item
Example: HTML Elements
<h1>This is a Heading</h1>
<p>This is a paragraph.</p>
<a href="https://example.com">Visit Example</a>
<img src="image.jpg" alt="Description">
<div>This is a div element.</div>
<span>This is a span element.</span>
<ul>
<li>Item 1</li>
<li>Item 2</li>
</ul>
Nested Elements
HTML elements can be nested inside other elements to create complex structures.
<div>
<h1>Title</h1>
<p>This is a paragraph inside a div.</p>
<ul>
<li>Nested Item 1</li>
<li>Nested Item 2</li>
</ul>
</div>
Next: HTML Forms