Introduction
Elements and Tags
An HTML element usually has three parts: an opening tag, some content, and a closing tag.
<p>This is a paragraph.</p>| Part | Example |
|---|---|
| Opening tag | <p> |
| Content | This is a paragraph. |
| Closing tag | </p> (note the forward slash) |
| Element | All three together |
Empty (void) elements
Some elements have no content and therefore no closing tag. They are called empty or void elements.
<br>
<hr>
<img src="photo.jpg" alt="A photo">
<input type="text">
<meta charset="UTF-8">Nesting elements
Elements can contain other elements. This is called nesting. Inner elements must be closed before outer ones.
<p>This is <strong>very</strong> important.</p>