Friday, July 26, 2024

HTML Headings


HTML headings are used to define the hierarchy and structure of content on a webpage. They range from <h1> to <h6>, with <h1> representing the highest level and <h6> the lowest. Headings help organize content and improve readability, making it easier for users and search engines to understand the document's structure. For example, <h1>Main Title</h1> is typically used for the primary heading, while <h2>Subheading</h2> indicates a secondary level. Proper use of headings enhances both accessibility and SEO.

Examples:

<h1>Main Title</h1>

<h2>Section Title</h2>

<h3>Subsection Title</h3>

<h4>Detail Title</h4>

<h5>Minor Detail Title</h5>

<h6>Least Important Title</h6>


HTML Code:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>HTML Tutorial</title>
</head>
<body>
    <h1>HTML Headings</h1>
    <p>HTML headings are defined with the <code>&lt;h1&gt;</code> to <code>&lt;h6&gt;</code> tags.</p>
    <pre>
        <h1>This is a Heading 1</h1>
        <h2>This is a Heading 2</h2>
        ...
        <h6>This is a Heading 6</h6>
    </pre>
</body>
</html>

The Output of the above code:


HTML Tutorial - Page 5

HTML Headings

HTML headings are defined with the <h1> to <h6> tags.

        

This is a Heading 1

This is a Heading 2

...
This is a Heading 6