Skip to main content

Understanding HTML Tags and Elements

Published 4 min readMarkdown
Part of seriesAssignments

Every website you’ve ever visited is built on HTML.

Before CSS makes things look good and JavaScript makes things interactive, HTML provides the structure — the skeleton — of a webpage.

If you’re learning web development, understanding HTML properly is your first big step.

Let’s break it down simply.


What is HTML and Why Do We Use It?

HTML stands for HyperText Markup Language.

HTML is used to:

  • Define the structure of a webpage

  • Tell the browser what content exists

  • Organize text, images, links, and sections

In simple words:

HTML is the skeleton of a webpage.

Just like a human skeleton gives shape to a body, HTML gives structure to a website.


What is an HTML Tag?

An HTML tag is a keyword wrapped in angle brackets:

<p>

Tags tell the browser:

“This is a paragraph”
“This is a heading”
“This is a division/section”

Think of a tag like a label on a box.


Opening Tag, Closing Tag, and Content

Most HTML tags come in pairs:

<p>Hello World</p>

Breakdown:

  • <p> → Opening tag

  • Hello World → Content

  • </p> → Closing tag

The closing tag has a / to show the end.


What is an HTML Element?

This is a very common beginner confusion.

Tag vs Element

HTML Tag:

Just the label:

<p>

HTML Element:

The complete thing:

<p>Hello World</p>

So:

An HTML element = opening tag + content + closing tag


Simple Box Analogy

Think of an element like a box:

+------------------+
|   Hello World   |
+------------------+
  • Opening tag = Start of box

  • Content = What’s inside

  • Closing tag = End of box


Self-Closing (Void) Elements

Some HTML elements don’t wrap content.

They don’t have closing tags.

Examples:

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

These are called:

  • Self-closing elements

  • Void elements

They represent things like:

  • Images

  • Line breaks

  • Inputs

  • Horizontal lines

They don’t contain text content inside.


Block-Level vs Inline Elements

HTML elements are generally either:

  • Block-level

  • Inline

This affects layout.


Block-Level Elements

Block elements:

  • Start on a new line

  • Take full width by default

Examples:

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

Visual Idea:

[ Heading            ]
[ Paragraph          ]
[ Division           ]

Each block sits on its own line.


Inline Elements

Inline elements:

  • Stay in the same line

  • Take only needed width

Examples:

<span>Text</span>
<a>Link</a>
<strong>Bold</strong>

Visual Idea:

This is [span] inside a sentence.

They flow with text.


Commonly Used HTML Tags (Beginner List)

Here are some core tags you’ll use all the time:

Headings

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

Paragraph

<p>This is a paragraph.</p>

Division (Generic Container)

<div>Some content</div>

Used to group elements.


Span (Inline Container)

<span>Highlighted text</span>

Used inside text.


<a href="https://example.com">Visit</a>

Images

<img src="image.jpg" alt="My Image">

Line Break

<br>

Encourage: Inspect HTML in the Browser

One of the best ways to learn HTML is:

Right-click → Inspect

You can:

  • See real HTML of websites

  • Explore DOM structure

  • Understand how elements are nested

This builds intuition fast.


Keep It Simple as a Beginner

You don’t need to learn:

  • Every HTML tag

  • Advanced semantic tags

  • Accessibility rules (yet)

Focus first on:

  • Structure

  • Tags vs elements

  • Block vs inline

  • Nesting elements


Diagram Ideas for Your Blog

1. Tag vs Element

<p> Hello </p>
 ^    ^     ^
Tag  Content Tag

Element = Entire line


2. Block vs Inline Layout

Block:
[ div              ]
[ p                ]
[ h1               ]

Inline:
Text [span] more text [a]

Credit: Chatgpt

No comments yet. Be the first to comment.