HTML Headings & Paragraphs
HTMLHTML 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
<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>
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
HTML headings are used to define titles and subtitles on a webpage using tags from <h1> to <h6>. They help structure content hierarchically.
<h1> is the most important heading and largest in size, while <h6> is the least important and smallest heading.
There are 6 levels of headings in HTML, from <h1> to <h6>.
Using a single <h1> improves SEO and accessibility by clearly defining the main topic of the page.
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
More on HTML Headings & Paragraphs
Cheatsheet, tips, resources & what to learn next
Quick Cheatsheet
<h1>Main Title</h1>
<h2>Sub Title</h2>
<h3>Section</h3>
<h4>Sub Section</h4>
<h5>Small</h5>\n<h6>Smallest</h6>
Pro Tips
Use only one <h1> per page.
Follow proper heading hierarchy.
Do not use headings just for styling.
Use CSS to control size instead.
Headings improve SEO and readability.