HTML Headings


🔹 What are HTML Headings?

HTML headings are used to define titles or subtitles in a web page. They help organize content, improve readability, and play an important role in SEO (Search Engine Optimization).

There are six levels of headings in HTML:

<h1> to <h6>
  • <h1> is the largest and most important heading.

  • <h6> is the smallest and least important heading.


🔹 Example: All 6 Headings
<h1>This is Heading 1</h1>
<h2>This is Heading 2</h2>
<h3>This is Heading 3</h3>
<h4>This is Heading 4</h4>
<h5>This is Heading 5</h5>
<h6>This is Heading 6</h6>
🔹 Output:

The text will appear in decreasing size from <h1> to <h6>.


🔹 Semantic Importance

Search engines use headings to index the structure and content of web pages.

  • <h1> is usually the main heading of a page (used only once)

  • <h2> to <h6> are used for subheadings


🔹 Example: Page Layout with Headings
<!DOCTYPE html>
<html>
<head>
  <title>Headings Example</title>
</head>
<body>

  <h1>Welcome to My Website</h1>
  <h2>About Us</h2>
  <p>We are a team of developers...</p>

  <h2>Services</h2>
  <h3>Web Development</h3>
  <h3>SEO Optimization</h3>

  <h2>Contact</h2>
  <p>Email us at support@example.com</p>

</body>
</html>

🔹 Tips for Using Headings

  • Use only one <h1> per page

  • Do not skip levels (e.g., don’t go from <h1> to <h4> directly)

  • Use headings to structure content, not just for font size


Practice Questions

Q1. Create an HTML page that includes all six heading tags.

Q2. Write a web page with one <h1> and two <h2> subheadings.

Q3. Add <h3> and <h4> headings under a service section.

Q4. Create a heading that says "My Blog" using <h1>.

Q5. Use <h5> to display a small subheading.

Q6. Nest a paragraph under an <h2> heading labeled "About Me".

Q7. Show a company name using <h1> and team roles using <h3>.

Q8. Make a simple portfolio layout using only heading tags.

Q9. Create a recipe structure using <h2> for steps and <h3> for details.

Q10. Use <h6> in a webpage footer for copyright.


Go Back Top