Skip to main content

Command Palette

Search for a command to run...

Understanding HTML Tags and Elements

HTML Tags vs Elements: A Beginner's Guide to Web Structure

Published
4 min read

HTML 101: Understanding the Skeleton of the Web

If you stripped away the paint, the electrical wiring, and the furniture from a house, what would you be left with?

The frame. The skeleton.

In the world of web development, HTML (Hyper Text Markup Language) is that skeleton. It does not handle the style (that's CSS) or the logic (that's JavaScript). Its only job is to give structure to your content.

Whether you want to build a simple portfolio or the next Facebook, everything starts here. Let’s learn the language of the web.

In this article, we will build a clear mental model of:

  • What HTML is

  • What tags and elements mean

  • How web pages are structured

  • And how to start reading HTML like a developer

No theory overload. Just simple explanations and visuals.

What HTML Is and Why We Use It

Simple definition
HTML (Hyper Text Markup Language) is the language used to structure content on the web.
It tells the browser:

  • This is a heading

  • This is a paragraph

  • This is an image

  • This is a button

Real-world analogy

HTML is the skeleton of a web page.
CSS is the skin.
JavaScript is the brain and muscles.

Without HTML, the browser has nothing to display.

What an HTML Tag Is

An HTML tag is a keyword wrapped in angle brackets:
<p>
<h1>
<div>

Tags tell the browser what type of content something is.

Analogy: A tag is like a label on a box:
This box contains a paragraph.

Opening Tag, Closing Tag, and Content

Tags almost always come in pairs and are surrounded by angle brackets < >.

  • Opening Tag: <p> (Starts the command)

  • Closing Tag: </p> (Ends the command—notice the forward slash /)

What an HTML Element Means

This is one of the most important concepts.

Tag vs Element

  • Tag: just the label

  • Element: tag + content + closing tag

  • Content: The text inside (e.g., "I love coding").

Example: <p>Hello</p>
This whole thing is an HTML element.

Self-Closing (Void) Elements

Most elements need to wrap around content, so they need a start and an end. But some elements are the content. These are called Self-Closing or Void elements.

They close themselves:
<img src="photo.jpg">
<br>
<input>

These are called:

  • Void elements

  • Self-closing elements

They represent single objects, not containers.

Because they don’t contain text or other elements.

  • <img> displays an image

  • <br> creates a line break

  • <hr> draws a horizontal line

They perform an action but don’t hold content.

Block-Level vs Inline Elements

Block-Level Elements:

These are the "greedy" elements. They take up the full width of the page, forcing the next element to start on a new line.
Examples: <h1>, <p>, <div>, <ul>

Inline Elements:

These are the "polite" elements. They only take up as much width as they need and sit side-by-side with other elements.
Examples: <span>, <a> (links), <b> (bold)

Commonly Used HTML Tags

You Will Use 90% of the Time

HTML has over 100 tags, but you only need to know a handful to build most websites.

TagNameDescriptionType
<h1> to <h6>HeadingsTitles and subtitles. h1 is the biggest.Block
<p>ParagraphStandard body text.Block
<a>AnchorCreates a link to another page.Inline
<img>ImageEmbeds a picture.Inline
<div>DivisionA generic container used to group elements.Block
<span>SpanA generic container for styling text.Inline
<ul> & <li>Unordered ListBullet points.Block

Learn HTML the Right Way (Pro Tip)

Right-click any website → Inspect

You will see:

  • Real production HTML

  • How big websites structure content

  • How elements are nested

This single habit makes you learn 10× faster.

Final Mental Model

In one paragraph:

HTML is the structural language of the web.
Tags label content, elements form structure, block elements control layout, inline elements style text, and the browser converts everything into a visual document tree.

Once HTML makes sense, CSS and JavaScript become easier automatically.