HTML provides several tags for displaying and formatting textual content on a webpage. These tags help organize information and improve readability, accessibility, and SEO.
<h1> - <h6>)Headings are used to define titles and section headings.
HTML provides six levels of headings.
<h1>Main Heading</h1>
<h2>Section Heading</h2>
<h3>Subsection Heading</h3>
<h4>Smaller Heading</h4>
<h5>Minor Heading</h5>
<h6>Smallest Heading</h6>
H1 - Largest
└─ H2
└─ H3
└─ H4
└─ H5
└─ H6 - Smallest
<h1> per page.<h1>Frontend Development</h1>
<h2>HTML</h2>
<h3>HTML Basics</h3>
<h2>CSS</h2>
<h3>CSS Selectors</h3>
Search engines use headings to understand the structure and importance of content on a webpage.
<p>)The <p> tag defines a paragraph of text.
<p>
HTML is the standard markup language for creating web pages.
</p>
HTML is the standard markup language for creating web pages.
<p>This is paragraph one.</p>
<p>This is paragraph two.</p>
<br>)The <br> tag inserts a line break.
<p>
Hello<br>
World
</p>
Hello
World
<br>
Kathmandu<br>
Nepal
<hr>)The <hr> tag creates a horizontal line.
<p>Chapter 1</p>
<hr>
<p>Chapter 2</p>
Chapter 1
-------------------
Chapter 2
The <hr> element indicates a thematic break between sections of content.
<b>, <strong>)HTML provides two ways to make text appear bold.
<b> TagThe <b> tag is used for stylistic bold text.
<p>This is <b>bold</b> text.</p>
This is bold text.
Visual emphasis only.
<strong> TagThe <strong> tag is used for important content.
<p>
Please read the <strong>instructions carefully</strong>.
</p>
Please read the instructions carefully.
Use:
<strong>
instead of:
<b>
when the text is important.
<i>, <em>)HTML provides two ways to display italic text.
<i> TagThe <i> tag is used for stylistic italics.
<p>I love <i>web development</i>.</p>
<em> TagThe <em> tag is used for emphasized text.
<p>
You <em>must</em> complete this task.
</p>
Use:
<em>
when emphasis is intended.
<pre>)The <pre> tag preserves spaces and line breaks exactly as written.
<pre>
Name: Samir
Age : 21
City: Jhapa
</pre>
Name: Samir
Age : 21
City: Jhapa
<mark>)The <mark> tag highlights text.
<p>
Learn <mark>HTML</mark> first.
</p>
Learn HTML first.
(HTML appears highlighted.)
<sub>)The <sub> tag displays text below the normal line.
H<sub>2</sub>O
H₂O
CO<sub>2</sub>
CO₂
<sup>)The <sup> tag displays text above the normal line.
x<sup>2</sup>
x²
10<sup>3</sup>
10³
<a>)The <a> (anchor) tag creates hyperlinks.
Links allow navigation between webpages, websites, email addresses, and phone numbers.
<a href="https://google.com">
Visit Google
</a>
Visit Google
(clickable)
Use the target="_blank" attribute to open a link in a new browser tab.
<a
href="https://google.com"
target="_blank"
>
Google
</a>
target="_blank"
Purpose
Opens the link in a new browser tab.
Create a link that opens the user's default email application.
<a href="mailto:test@example.com">
Email Me
</a>
Create a clickable phone number.
<a href="tel:+9779800000000">
Call Us
</a>
Use relative URLs to navigate between pages within the same website.
<a href="/about">
About Us
</a>
| Attribute | Purpose |
|---|---|
href |
Destination URL |
target |
Specifies where the link opens |
title |
Tooltip text |
download |
Downloads the linked file |
The download attribute tells the browser to download a file instead of opening it.
<a
href="resume.pdf"
download
>
Download Resume
</a>
| Tag | Purpose |
|---|---|
h1–h6 |
Headings |
p |
Paragraphs |
br |
Line Break |
hr |
Horizontal Line |
b |
Bold Styling |
strong |
Important Bold Text |
i |
Italic Styling |
em |
Emphasized Text |
pre |
Preserve Formatting |
mark |
Highlight Text |
sub |
Subscript |
sup |
Superscript |
a |
Hyperlinks |
These tags form the foundation of content presentation in HTML.
<h1>HTML Basics</h1>
<p>HTML structures web content.</p>
<strong>Important Note</strong>
<em>Learn HTML before CSS.</em>
<a href="https://developer.mozilla.org">
Learn More
</a>
As you continue learning HTML, these text and content elements will help you create well-structured, accessible, and SEO-friendly webpages.