New: Complete Beginner's Guide to Coding is now available in Premium
Updated: Indian Govt Exam roadmaps now include salary breakdowns & timelines
Tip: Use the Career Hub to explore all career paths in one place
Tutorials HTML HTML Headings & Paragraphs

HTML Headings & Paragraphs

HTML

HTML has 6 heading levels: <h1> (largest) to <h6> (smallest).

Paragraphs are defined with <p>. Line breaks use <br>.

Rules

  • Use only ONE <h1> per page (for SEO)
  • Headings should be in order: h1 → h2 → h3
  • Paragraphs automatically add space above and below
Example — HTML
<h1>Main Title</h1>
<h2>Section Title</h2>
<h3>Sub Section</h3>
<p>This is a paragraph of text.
It can span multiple lines.</p>
<p>This is another paragraph.</p>
Result

Main Title

Section Title

Sub Section

This is a paragraph of text. It can span multiple lines.

This is another paragraph.

Interview Questions — HTML Headings & Paragraphs

5 questions commonly asked in interviews

Q1 What are HTML headings? Beginner

HTML headings are used to define titles and subtitles on a webpage using tags from <h1> to <h6>. They help structure content hierarchically.

Q2 What is the difference between <h1> and <h6>? Beginner

<h1> is the most important heading and largest in size, while <h6> is the least important and smallest heading.

Q3 How many heading levels are available in HTML? Beginner

There are 6 levels of headings in HTML, from <h1> to <h6>.

Q4 Why should only one <h1> be used per page? Intermediate

Using a single <h1> improves SEO and accessibility by clearly defining the main topic of the page.

Q5 Are heading sizes controlled only by HTML? Intermediate

No, heading sizes can be customized using CSS regardless of the default HTML size.

Frequently Asked Questions

Common doubts about HTML Headings & Paragraphs

Technically yes, but it is not recommended. Always follow a proper hierarchy like h1 → h2 → h3.

It is allowed in HTML5, but best practice is to use only one for SEO clarity.

Yes, search engines use headings to understand page structure and importance.

Yes, headings can contain inline elements like <span>, <a>, etc.

Not mandatory, but highly recommended for structure and readability.

Test Your Knowledge

5 questions · Earn 50 XP

0 / 5
Q1 Which is the highest priority heading?
Q2 How many heading levels exist?
Q3 Which tag is smallest?
Q4 Headings help in?
Q5 Which is correct order?

More on HTML Headings & Paragraphs

Cheatsheet, tips, resources & what to learn next

Quick Cheatsheet

H1
<h1>Main Title</h1>
H2
<h2>Sub Title</h2>
H3
<h3>Section</h3>
H4
<h4>Sub Section</h4>
H5 & H6
<h5>Small</h5>\n<h6>Smallest</h6>

Pro Tips

1

Use only one <h1> per page.

2

Follow proper heading hierarchy.

3

Do not use headings just for styling.

4

Use CSS to control size instead.

5

Headings improve SEO and readability.

Up Next

HTML Paragraphs HTML Links HTML Images HTML Lists HTML Tables