HTML Elements & Tags

Understanding HTML Elements

HTML elements are defined by tags. Most elements have an opening tag and a closing tag with content in between.

Some elements are self-closing (also called void elements) and don't need a closing tag.

<!-- Element with opening and closing tags -->
<p>This is a paragraph</p>

<!-- Self-closing element -->
<img src="image.jpg" alt="Description">
<br>
<hr>
  • Opening tag:
  • Content: Text or other elements
  • Closing tag:
  • Self-closing: or

Try Different Elements

<h1>Main Heading</h1>
<p>This is a paragraph with <strong>bold text</strong> and <em>italic text</em>.</p>
<hr>
<p>Another paragraph below the line.</p>

Note: Tags are case-insensitive but lowercase is the standard convention.