D Dev Notebook

HTML5 Headings & Paragraphs

HTML

What are Headings in HTML5?

Headings are used to define titles and subtitles on a web page.

They help organize content into sections and are important for readability, SEO, and accessibility

HTML provides 6 levels of headings

TagMeaning
<h1>Main heading(biggest, most important)
<h2>Sub-heading
<h3>Sub-sub-heading
<h4>Smaller level heading
<h5>Even smaller
<h6>Smallest heading
  • From most important (<h1>) to least important (<h6>).

This is an H1 heading

This is an H2 heading

This is an H3 heading

This is an H4 heading

This is an H5 heading
This is an H6 heading

  • Use only one <h1> per page(for the main topic).

  • Use <h2> to <h6> for subsections, maintaining a clear hierarchy.

  • Helps search engines understand your page structure, and assists screen readers for visually impaired users.

What are Paragraphs in HTML5?

  • Paragraphs are used to display blocks of text.

  • They are created with the <p> tag.

<p>This is a paragraph. It contains some text about a topic.</p>

Example of paragraphs with headings

<h1>About Space Exploration</h1>
<p>Space exploration is the use of astronomy and space technologies to explore outer space.</p>

<h2>Why Explore Space?</h2>
<p>It helps us understand more about our universe, and drives new technology development.</p>