Understanding HTML Tags and Elements
Learn the difference between HTML tags and elements, opening and closing tags, void elements and common page structures.
On this page 24
If you’ve ever looked at a webpage and wondered why a headline is big, why paragraphs line up neatly, or how an image sits beside text—the answer always starts with HTML.
HTML (HyperText Markup Language) is the skeleton of every webpage. CSS is the skin and clothing. JavaScript is the brain and muscles. But HTML is what gives a webpage its structure.
Without HTML, your page would just be a long stream of unorganized text. HTML provides the building blocks that tell the browser what each piece of content is.
To understand HTML, you only need to learn two fundamental ideas:
Tags
Elements
Let’s break both down in the simplest possible way.
What Is HTML and Why Do We Use It?
HTML gives meaning and structure to content. It tells the browser:
- “This is a heading”
- “This is a paragraph”
- “This is an image”
- “This is a link”
Without HTML, browsers wouldn’t know how to organize or display anything.
What Is an HTML Tag?
A tag is a keyword wrapped in angle brackets < > that tells the browser how to treat content.
Examples:
<h1>
<p>
<div>
<a>Tags are invisible to the user—they only act as instructions for the browser.
Simple analogy:
A tag is like a sticky label: “This is a title.” “This is a paragraph.” “This is an image.”
Opening Tag, Content, Closing Tag (The Sandwich Structure)
Most HTML structures come in three parts:
- Opening tag
- Content
- Closing tag
Example:
<h1>This is a main heading</h1>
<p>This is a paragraph of text.</p>A closing tag always includes a slash:
</p>
</h1>If you forget a closing tag, your entire page layout may break.
Tag vs. Element (The Most Important Difference)
This is where beginners often get confused.
A Tag
Only the bracketed code itself:
<p> or </p> or <h1>.
An Element
The complete structure: opening tag + content + closing tag.
Example:
<p>This is an element.</p>Analogy:
Think of an element as a cardboard box:
- opening tag = bottom flaps
- content = items inside
- closing tag = top flaps
- whole sealed box = the element
Self-Closing (Void) Elements
Some elements don’t wrap around content—they are the content. So they don’t need closing tags.
Examples:
<img src="image.jpg" alt="Example">
<br>
<hr>
<input type="text">These are called:
- self-closing
- void elements
- empty elements
They act like single-use instructions.
Block-Level vs Inline Elements
HTML elements don’t all behave the same. Some force a new line; some sit inside text.
1. Block-Level Elements
They:
- start on a new line
- take full available width
- stack vertically
Examples:
<h1>
<p>
<div>
<ul>Example usage:
<h1>I am block-level</h1>
<p>I appear on the next line.</p>2. Inline Elements
They:
- do not start on a new line
- only take up the space they need
- flow inside text
Examples:
<strong>
<a>
<span>Example usage:
<p>This is a paragraph with <strong>bold text</strong> inside it.</p>Common HTML Tags Every Beginner Should Know
These tags form the foundation of nearly every webpage:
Headings
<h1> to <h6>Paragraph
<p>Link
<a href="https://example.com">Click me</a>Image
<img src="image.jpg" alt="Description">Lists
Unordered list:
<ul>
<li>Item</li>
</ul>Ordered list:
<ol>
<li>Item</li>
</ol>Block Container
<div>Inline Container
<span>These become essential once you start styling or structuring content.
Pro Tip: Inspect Websites to Learn Faster
Right-click any webpage → Inspect.
You’ll instantly see:
- the tags used
- how elements are nested
- how block and inline elements behave
It’s the best free HTML learning tool in existence.
Conclusion
Once you understand:
- what tags are
- what elements are
- the difference between opening/closing tags
- what block vs inline means
- and the most common HTML tags
…you understand the core of HTML.
This foundation is what makes CSS, JavaScript, and modern frameworks finally make sense.
Master HTML structure, and everything else in web development becomes dramatically easier.
Comments 00
Got something to say? Leave a comment.
Join the discussion ↗