Skip to main content

Command Palette

Search for a command to run...

Understanding HTML Tags and Elements

Published
3 min read

What Is HTML? Understanding Tags and Elements in Simple Words

When you open any website, what you see on the screen looks fancy — buttons, text, images, layouts. But behind all of this, there is something very simple holding everything together.

That something is HTML.

I like to think of HTML as the skeleton of a webpage. Just like our body needs bones for structure, websites need HTML to organize content.

Let’s break it down in the simplest way possible.


What Is HTML and Why Do We Use It?

HTML stands for HyperText Markup Language.

HTML is used to:

  • Structure web pages

  • Display text, images, links, and buttons

  • Tell browsers what content is and how it is organized

Important thing to remember:

👉 HTML does NOT design the page
👉 HTML does NOT add logic

Its main job is structure and content.

CSS handles design.
JavaScript handles behavior.
HTML builds the base.


What Is an HTML Tag?

An HTML tag is like a label that tells the browser what something is.

Example:

<p>Hello World</p>

Here:

  • <p> tells the browser: “This is a paragraph”

  • </p> tells the browser: “Paragraph ends here”

Think of tags like boxes with names on them.

You label content so the browser knows how to display it.


Opening Tag, Closing Tag, and Content

Most HTML tags have three parts:

Example:

<h1>Welcome</h1>

1. Opening Tag

<h1> → Starts the element

2. Content

Welcome → Actual text or data

3. Closing Tag

</h1> → Ends the element

So it becomes:

👉 Start → Content → End

Simple and logical.


What Is an HTML Element? (Important Difference)

Many beginners confuse tag and element.

Let’s make it clear:

Tag

Only the label part.

Example:

<p>
</p>

Element

The complete structure:

Opening tag + Content + Closing tag

Example:

<p>This is a paragraph</p>

So:

👉 Tag = part
👉 Element = full package


Self-Closing (Void) Elements

Some HTML elements do not need closing tags.

They are called self-closing or void elements.

Example:

<img src="photo.jpg">
<br>
<hr>

These tags don’t wrap content. They perform a single action:

  • img → displays image

  • br → line break

  • hr → horizontal line

Think of them as one-time actions, not containers.


Block-Level vs Inline Elements

This is another important concept.


Block-Level Elements

Block elements:

  • Start on a new line

  • Take full width

Examples:

<div>
<p>
<h1>
<section>

They behave like big boxes stacked vertically.


Inline Elements

Inline elements:

  • Stay in the same line

  • Take only needed space

Examples:

<span>
<a>
<strong>

They behave like small labels inside text.


Simple Example

<p>This is a <span>small text</span> inside a paragraph.</p>

Here:

  • p is block-level

  • span is inline


Commonly Used HTML Tags

Here are some tags you’ll use almost every day:

Headings

<h1>Main Heading</h1>
<h2>Sub Heading</h2>

Used for titles.


Paragraph

<p>This is text</p>

Used for content.


Div (Container)

<div>Content here</div>

Used to group elements.


Span (Inline Container)

<span>Small text</span>

Used inside text.


<a href="#">Click here</a>

Used for navigation.


Image

<img src="image.jpg">

Used to display images.


Bonus Tip: Inspect HTML in Your Browser

One of the best ways to learn HTML is:

👉 Right-click on any website
👉 Click Inspect

You’ll see the real HTML structure behind the page.

This is how I personally learned how professional websites are built.