DevAcademy
LearnHTMLHeadings & Paragraphs
BeginnerHTML

Headings & Paragraphs

Structure text content correctly using heading levels and paragraphs, and understand why heading hierarchy matters.

Reading Time

10 min

Lesson

Lesson 7 of 27

Headings

HTML provides six levels of headings, from <h1> (most important) to <h6> (least important). Headings give text structure and help both readers and search engines understand the page outline.

Heading Levels

<h1>Main Page Title</h1>
<h2>Section Heading</h2>
<h3>Sub-section Heading</h3>
<h4>Smaller Heading</h4>
<h5>Even Smaller</h5>
<h6>Smallest Heading</h6>
Output

Paragraphs

The <p> element defines a paragraph of text. Browsers automatically add space before and after each paragraph.

Paragraph Example

<p>HTML paragraphs are used to group related sentences into blocks of text.</p>
<p>Each new paragraph starts on its own line.</p>
Output

Heading Usage

HeadingTypical Use
<h1>The single main title of the page
<h2>Major section headings
<h3>–<h6>Nested sub-sections, in decreasing importance

One <h1> Per Page

Best practice is to use exactly one <h1> per page — it should describe the main topic of the page, similar to a book title.

Do Not Skip Levels for Styling

Never choose a heading level just because of its default font size (e.g. using <h3> because it looks smaller). Use CSS for styling and choose heading levels based on document structure instead.

Best Practice

Keep heading levels in order (h1 → h2 → h3) without skipping levels. This creates a logical outline that screen readers use for navigation.

Interview Questions

Quick Quiz

1. How many heading levels does HTML provide?

2. How many <h1> elements should a well-structured page typically have?

3. Which element is used to define a paragraph?