Skip to main content

Command Palette

Search for a command to run...

Understanding HTML Tags and Elements

Published
2 min read

What Is HTML and Why Do We Use It?

HTML stands for HyperText Markup Language, and it exists to give structure to content on the web.

When a browser receives a webpage, the first thing it understands is HTML. HTML tells the browser what the content is — a heading, a paragraph, an image, or a link. Without HTML, a webpage would just be plain text with no structure.

Think of HTML as the skeleton of a webpage.
CSS styles it.
JavaScript makes it interactive.

What Is an HTML Tag?

An HTML tag is a marker that tells the browser how to treat content.

For example:

<p>This is a paragraph</p>

Here, <p> tells the browser that the text inside should be treated as a paragraph.

Opening Tag, Closing Tag, and Content

Most HTML tags come in pairs: an opening tag, some content, and a closing tag.

Example:

<h1>Welcome</h1>
  • <h1> → opening tag

  • Welcome → content

  • </h1> → closing tag

What Is an HTML Element?

This is a small but important distinction.

A tag is just the label (<p>).
An element is the full structure.

Example:

<p>Hello World</p>

The entire line above is an HTML element, not just a tag.

Self-Closing (Void) Elements

Some HTML elements don’t wrap content, so they don’t need a closing tag.

Example:

<img src="photo.jpg">

Here, the image itself is the content. That’s why there is no </img>.

Common self-closing elements include images, line breaks, and inputs.

Block-Level vs Inline Elements

HTML elements also differ in how they use space on the page.

A block-level element starts on a new line and takes up the full width.

Example:

<p>This is a paragraph</p>
<p>This appears on a new line</p>

An inline element stays within the same line.

Example:

<p>This is <span>inline text</span> inside a paragraph</p>

The paragraph is block-level.
The span only wraps part of the sentence.

Commonly Used HTML Tags (Beginner-Friendly)

<h1>Main Heading</h1>
<p>A simple paragraph</p>

<div>
  <p>Grouped content</p>
</div>

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

Here:

Headings (h1 to h6) are used for titles and sections.
Paragraphs (p) are used for text content.
div is a generic container used to group elements.
a is used for links.

Final Takeaway

HTML is not about design or logic.
It’s about structure and meaning.

Once you understand tags, elements, and how content is organized, CSS and JavaScript make far more sense. HTML gives the browser a map — everything else builds on top of it.

You’re learning this the right way: slowly, visually, and concept-first.