Skip to main content

Command Palette

Search for a command to run...

Understanding HTML Tags and Elements

Published
Understanding HTML Tags and Elements
M

I believe writing makes learning easier so I share simple Tech notes with diagrams

Introduction -

When you open any website what you see on the screen is the result of many things working together. But at the base of it all is HTML. HTML is not about design or logic. It is about structure.
If a webpage were a human body HTML would be the skeleton that gives it shape.

Let’s understand what HTML tags and elements really are, without making it complicated.

What HTML Is and Why We Use It -

HTML stands for HyperText Markup Language. It is used to:

  • Define headings

  • Create paragraphs

  • Add links, images, and lists

  • Structure content on a webpage

HTML tells the browser:
“This is a heading”
“This is a paragraph”
“This is a button”

Without HTML a browser would not know how to organize or display content properly.

What an HTML Tag Is -

An HTML tag is a label that tells the browser what kind of content it is dealing with. A tag is written inside angle brackets. For example: <p>

This tag tells the browser that the content inside it is a paragraph. You can think of a tag like a label on a box. The label does not hold anything itself but it tells you whats inside.

Opening Tag, Closing Tag, and Content -

Most HTML tags come in pairs.
Example —> Hello World (output)
Here <p> is the opening tag & </p> is the closing tag between them Hello World is the content

The browser reads this as “This text should be treated as a paragraph.” The opening tag starts the instruction and the closing tag ends it.

What an HTML Element Means -

This is where beginners often get confused an HTML element is the complete thing:

  • Opening tag

  • Content

  • Closing tag

So in this example —> Hello World

The entire line is one HTML element in simple terms:

  • Tag = part of the instruction

  • Element = the full structure

Self Closing (Void) Elements -

Some HTML elements don’t have content they exist only to perform a specific task.

Examples:
<img>
<br>
<input>

These are called self closing or void elements they don’t wrap content, so they don’t need a closing tag.

For example —> <img src="photo.jpg">

This tells the browser to show an image not to wrap text.

Block Level vs Inline Elements -

HTML elements behave differently on the page.
Block level elements:

  • Start on a new line

  • Take full width by default

Examples:
Inline elements: Stay in the same line Take only as much space as needed Examples:
<span>
<a>
<strong>
Think of it like this as Block elements are like paragraphs in a book and Inline elements are like words inside a sentence.

Commonly Used HTML Tags -

Here are some tags you will see almost everywhere:

  • <h1> to <h6> Used for headings from most important to least important.

  • <p> Used for paragraphs.

  • <div> Used as a container to group elements.

  • <span> Used to style or target small pieces of text.
  • <img> Used to display images.
These tags form the foundation of most webpages.

Learn by Inspecting HTML in the Browser -

One of the best ways to learn HTML is to inspect existing websites. Right click on any webpage and choose “Inspect”. You will see:

  • Real HTML

  • How tags are nested

  • How elements are structured

This helps you understand how theory turns into real pages.

Conclusion -

HTML is simple by design it does not try to be smart or complex its job is only to describe structure.
Once you understand:

  • What a tag is

  • What an element is

  • How content is wrapped

You’ll find HTML easy to read, write, and debug. Everything else in web development builds on this foundation.