"I am Saqib Jahangir. A passionate vlogger, software engineer, and avid traveler with a deep love for exploring the hidden gems of our beautiful planet. With a strong foundation in Application Development, Application Architecture & Database Design and Product Management, I bring over a decade of hands-on experience building secure, scalable, and resilient web applications for a diverse range of industries."

Headings

 

Headings are one of the most essential parts of any webpage. They help organize content, improve readability, and are important for search engine optimization (SEO).

What Are Heading Tags?

HTML provides six levels of headings, from <h1> (most important) to <h6> (least important):

<h1>This is a Heading 1</h1>

<h2>This is a Heading 2</h2>

<h3>This is a Heading 3</h3>

<h4>This is a Heading 4</h4>

<h5>This is a Heading 5</h5>

<h6>This is a Heading 6</h6>

How They Look in the Browser

Each heading tag displays the text in a different font size by default, with <h1> being the largest and <h6> the smallest.

Let’s test this using your local XAMPP or WAMP setup.


๐Ÿงช Example: Create a Simple Page with Headings

  1. Open your XAMPP/WAMP server and make sure Apache is running.
  2. Create a new file named headings.html in the htdocs (XAMPP) or www (WAMP) folder.
  3. Paste the following code:

<!DOCTYPE html>

<html>

<head>

    <title>HTML Headings Example</title>

</head>

<body>

    <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>

</body>

</html>

  1. Open your browser and go to:
    • http://localhost/headings.html (for XAMPP)
    • http://localhost/yourfoldername/headings.html (if it's in a subfolder)

You’ll see all six headings displayed with decreasing size.


๐Ÿ“ Best Practices for Headings

  • Use <h1> only once per page, typically for the main title.
  • Use <h2> for section headings, <h3> for subsections, and so on.
  • Headings should be used for structure, not just to make text look bigger or bolder.

 

Popular Posts

Setting Up Your First Project Folder and Installing XAMPP or WAMP

Frontend vs Backend vs Full Stack