HTML Elements & Tags
What is an HTML element?
An HTML element is a piece of content wrapped in tags. Most elements have an opening tag and a closing tag:
HTML
<p>This is a paragraph.</p><p>is the opening tag.</p>is the closing tag (note the/).- Everything between them is the content.
HTML
<img src="photo.jpg" alt="A photo" />
<br />
<hr />Common HTML elements
Here are the elements you'll use most often:
Headings — six levels from
<h1> (biggest) to <h6> (smallest):HTML
<h1>Main Title</h1>
<h2>Section Title</h2>
<h3>Subsection</h3>Paragraphs and text:
HTML
<p>This is a paragraph of text.</p>
<strong>Bold text</strong>
<em>Italic text</em>Links — the
<a> tag makes clickable links:HTML
<a href="https://example.com">Visit Example</a>Images:
HTML
<img src="cat.jpg" alt="A cute cat" width="300" />Always include the
alt attribute — it describes the image for screen readers and shows up if the image fails to load.Lists:
HTML
<ul>
<li>Unordered item</li>
<li>Another item</li>
</ul>
<ol>
<li>First step</li>
<li>Second step</li>
</ol>Nesting elements
Elements can go inside other elements. This is called nesting:
HTML
<div>
<h2>About Me</h2>
<p>I am learning <strong>HTML</strong>.</p>
</div>The key rule: always close inner elements before outer ones. Think of it like stacking boxes — the last one opened must be the first one closed.
Key takeaway
HTML elements are the building blocks of every web page. Learn the common ones first (
h1–h6, p, a, img, ul, ol, div), and you'll be able to build most page layouts.