Skip to main content

Command Palette

Search for a command to run...

Understanding HTML Tags and Elements

Let's crack the HTML

Published
3 min read
Understanding HTML Tags and Elements
A

I’m a 4th-year CSE student learning and building in the world of full-stack web development 💻. My core focus is on HTML, CSS, and JavaScript, and I’m currently learning React to strengthen my frontend skills.

On the backend, I work with Node.js and Express, exploring how things work behind the scenes and how real-world web apps are built.

I write beginner-friendly technical blogs where I explain concepts in simple language, using real examples and memes 😄 so learning web development doesn’t feel boring.

If you’re just starting out and feeling confused, you’re in the right place 🙂 Let’s learn, break code, and grow together 🚀

What HTML is and why we use it

Before learning HTML, let’s understand what a webpage actually is.

When you open any website, what you see on the screen (text, buttons, headings, images) needs some basic structure.
That structure is made using HTML.

HTML in simple words 🦴

HTML is the skeleton of a webpage.

Just like:

  • Human body has bones

  • A house has walls and rooms

A webpage has HTML.

HTML tells the browser:

  • “This is a heading”

  • “This is a paragraph”

  • “This is a button”

Without HTML, a website would have no shape at all.


What an HTML tag is

HTML works using something called tags.

Real life example 📦

Think of tags like labels on boxes.

If a box has a label:

“Books”

You know what’s inside.

Same way, HTML tags tell the browser what kind of content is inside.

Example:

<p>Hello World</p>

Here, <p> tells the browser:

“This is a paragraph”


Opening tag, closing tag, and content

Most HTML tags have three parts.

Let’s break it slowly 👇

<p>Hello</p>
  • <p> → opening tag

  • Hello → content

  • </p> → closing tag

Simple sentence example ✍️

Think of it like:

“Start speaking” → words → “stop speaking”

If you forget the closing tag, browser may get confused (sometimes it still works, but don’t trust it 😅).


What an HTML element means

This part confuses many beginners (including me at first).

Tag vs Element (very important)

  • HTML tag → just the label (<p>)

  • HTML element → opening tag + content + closing tag

Example:

<p>I am learning HTML</p>

👉 This whole thing is an HTML element

So:

  • Tag = part

  • Element = complete thing

Once you get this, many doubts go away.


Self-closing (void) elements

Some HTML elements don’t have content.

So they don’t need a closing tag.

Example 🧩

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

These are called:

  • self-closing elements

  • or void elements

They just do one job and move on.


Block-level vs inline elements

This sounds complex, but it’s actually simple.

Block-level elements 📦

  • They start on a new line

  • They take full width

Examples:

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

Think of them like big boxes.


Inline elements ✏️

  • They stay in the same line

  • They take only needed space

Examples:

<span>word</span>
<a>link</a>

Think of them like words inside a sentence.


Commonly used HTML tags

Let’s not overload. These are enough for starting.

Basic tags you’ll use daily

<h1>Heading</h1>
<p>Paragraph</p>
<div>Container</div>
<span>Small text</span>

What they do:

  • h1 → heading

  • p → paragraph

  • div → box/container

  • span → inline text

That’s it. Don’t try to memorise everything.


A small tip for learners 👀

Open any website → right click → Inspect

You’ll see:

  • HTML structure

  • Tags

  • Elements

This is honestly one of the best ways to learn HTML.

I personally learned a lot just by inspecting random websites.


Final thoughts 🌱

HTML is not hard.
It’s just structure and meaning.

If you understand:

  • tags

  • elements

  • block vs inline

You are already ahead of many beginners.

Don’t rush.
Practice small.
Mistaks are part of learning (I still make them).

More from this blog

Baki-Bytes

13 posts

A developer blog where learning happens by breaking things, fixing bugs, and finally saying “ohhh, that makes sense” 😅 Simple explanations, real examples, and memes included.