What is an Element?
An HTML element consists of an opening tag, content, and a closing tag:
<tagname>Content</tagname>Example:
<p>This is a paragraph.</p>
<h1>This is a heading.</h1>
<strong>This is bold text.</strong>Self-Closing Elements
Some elements have no content and no closing tag:
<br> <!-- line break -->
<hr> <!-- horizontal rule -->
<img src="photo.jpg" alt="A photo">
<input type="text">Block vs Inline
| Type | Behavior | Examples |
|---|---|---|
| Block | Starts on a new line, full width | div, p, h1, ul, table |
| Inline | Flows within text, takes only needed width | span, a, strong, em, img |