Skip to main content

Command Palette

Search for a command to run...

Understanding HTML Tags and Elements

Published
3 min read

What HTML is ?

HTML stand for Hyper Text Markup Language.

HTML (HyperText Markup Language) is the standard language used to create and structure web pages. It uses tags and elements to define headings, paragraphs, images, links, and other components that browsers display on the screen.

HTML is platform-independent and runs on all browsers.


Why we use HTML

HTML is used to create structure of a web page.

Learning HTML is essential because it forms the foundation of every website and is the first step toward becoming a web developer.

CSS make website look good
JavaScript make website interactive
But HTML is the skeleton of the web page.


What an HTML tag is

HTML tag is a special keyword written inside angle brackets < >.

Tag tell browser what kind of content it is.

Example:

<p>
<h1>
<img>

Each tag have its own work.

<p> tell this is a paragraph
<h1> tell this is a heading
<img> tell this is an image


Opening tag, closing tag, and content

Most HTML tags have opening tag and closing tag.

Example:

<p>Hello World</p>

<p> → opening tag
</p> → closing tag
Hello World → content


What an HTML element means

HTML element is full structure together.

Opening tag + content + closing tag = HTML element

Example:

<h1>Welcome</h1>

This whole line is one HTML element.

Element tell browser:

  • what type of content

  • and what content it is


Self-closing (void) elements

Some HTML tags don’t have closing tag.

These are called self-closing or void elements.

Example:

<img>
<br>
<input>

These tags don’t wrap content.
They just perform one action.

<img> show image
<br> break line
<input> take input from user


Block-level vs inline elements

Block-level elements

Block elements always start from new line.
They take full width of page.

Example:

<div>
<p>
<h1>

If you use block element, next content go to next line.


Inline elements

Inline elements stay in same line.
They take only required space.

Example:

<span>
<a>
<strong>

Inline elements are mostly used inside block elements.


Commonly used HTML tags

Some HTML tags are used in almost every website.

Structure tags

<html>
<head>
<body>

Text tags

<h1> to <h6>
<p>
<span>
<img>
<a>

Form tags

<input>
<button>

These tags help browser understand what content is text, image, link, or input.


In the conclusion

HTML is the foundation of web development.

It give structure to website.
It tell browser how to display content.

Without HTML, web page can’t exist.

HTML is first step for every web developer.