Skip to main content

Command Palette

Search for a command to run...

Understanding HTML Tags and Elements

Updated
3 min read

When you look at a webpage, you see text, images, buttons, and layouts. But underneath all that polish lies something much simpler HTML. Think of HTML as the skeleton of a webpage. Just like bones give structure to the human body, HTML gives structure to everything you see on the web.

Let’s break it down gently and build the mental model the right way.

What is HTML and Why Do We Use It?

HTML (HyperText Markup Language) is the language used to describe the structure of a webpage. It doesn’t decide colors, animations, or interactions. Its job is much more fundamental.

HTML answers questions like -

  • This is a heading

  • This is a paragraph

  • This is a button

  • This is a section of the page

Browsers read HTML and understand what each piece of content represents. CSS makes it look good, JavaScript makes it interactive, but HTML comes first.

What Is an HTML Tag?

An HTML tag is like a label. It tells the browser what kind of content it is about to see. You can think of a tag like words inside angle brackets -

<p>

This tag tells the browser: A paragraph is starting here.” Tags are not content. They are instructions.

Opening Tag, Closing Tag, and Content

<p>Hello, world!</p>

Let’s break this down:

  • <p>Opening tag

  • </p>Closing tag

  • Hello, world!Content

What Is an HTML Element?

This is where beginners often get confused. A tag is not the same as an element.

An HTML element includes -

  • The opening tag

  • The content

  • The closing tag

So, this entire thing is am element -

<p>Hello, world!</p>

Self-Closing (Void) Elements

Some elements don’t wrap content at all.

For instance -

<img />
<br />

These are called self-closing or void elements. They exist on their own and don’t need a closing tag. Why? Because there’s nothing to put inside them.

HTML elements fall into two broad categories.

Block-level elements

They start on a new line and take up full width.

<h1>Heading</h1>
<p>Paragraph</p>
<div>Container</div>

Inline elements

They live inside text and only take as much space as needed.

<span>text</span>
<strong>bold</strong>

Commonly Used HTML Tags

Here are a few you’ll use constantly:

  • <h1> to <h6> – headings

  • <p> – paragraphs

  • <div> – generic container

  • <span> – inline container

  • <img> – images

  • <a> – links

Don’t try to memorize everything. HTML is learned by usage, not rote memory.

A Final Tip: Inspect the Web

One of the best ways to learn HTML is to right-click any webpage and click “Inspect”. You’ll see real HTML in action messy, imperfect, and real. That’s how you learn by reading, writing, and inspecting. HTML may look simple and it is but it’s also the foundation everything else stands on. Get this right, and the rest of the web starts making sense.