Headings are used to specify the titles and subtitles of sections or sub-sections in an HTML document. Depending on the hierarchical importance and structural prominence of the text, six available levels from <h1> to <h6> can be used. <h1> defines the highest-level, most important heading, while <h6> defines the lowest level. Browsers automatically render headings in bold font and insert vertical margins (white space) before and after each heading. Heading tags are paired container tags, meaning every opening tag must be matched by a closing tag with a forward slash (e.g., </h1>).
<h1>Heading Level 1 - Main Page Topic</h1>
<h2>Heading Level 2 - Major Section Title</h2>
<h3>Heading Level 3 - Subsection Title</h3>
<h4>Heading Level 4 - Detailed Topic Point</h4>
<h5>Heading Level 5 - Minor Sub-point</h5>
<h6>Heading Level 6 - Lowest Level Reference</h6>
Each heading tag serves a distinct structural and semantic role in your document layout:
| Tag | Default Browser Font Size | Semantic Role & Usage |
|---|---|---|
<h1> |
2.00em (approx. 32px) | The primary headline of the entire page. Should summarize the central topic. |
<h2> |
1.50em (approx. 24px) | Major chapter or section headings across the document. |
<h3> |
1.17em (approx. 18.7px) | Sub-topics grouped beneath an <h2> section. |
<h4> |
1.00em (approx. 16px) | Specific sub-items, code breakdown headers, or side notes within an <h3>. |
<h5> |
0.83em (approx. 13.3px) | Minor headings, sidebar widget headers, or tertiary footnotes. |
<h6> |
0.67em (approx. 10.7px) | The smallest heading level, rarely used except in complex academic papers. |
Search engines such as Google use headings to index the structure and topical depth of your articles. Follow these golden rules to maximize your website rankings:
<h1> tag per page representing the main article title. Including multiple H1 tags dilutes your page's primary keyword focus.<h1> to <h2>, then <h3>). Jumping directly from <h1> to <h4> confuses search engine crawlers and screen readers.<h3> tag simply because you want it to look bold or larger. Always use CSS (e.g., font-size: 20px; font-weight: bold;) for visual styling, reserving heading tags strictly for structural semantics.Problem Statement: Write a clean HTML5 webpage introducing "Computer Memory Types" using a strict 3-tier heading structure (H1 for page title, H2 for Primary vs Secondary memory, and H3 for specific memory types like RAM, ROM, HDD, SSD).
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Computer Memory Hierarchy - BCA Practical 6</title>
</head>
<body>
<h1>Guide to Computer Memory Systems</h1>
<p>Computer memory is divided into primary internal storage and secondary storage.</p>
<h2>1. Primary (Main) Memory</h2>
<h3>A. Random Access Memory (RAM)</h3>
<p>Volatile memory used to store active programs and instructions during execution.</p>
<h3>B. Read Only Memory (ROM)</h3>
<p>Non-volatile memory containing bootstrap loader and fundamental firmware instructions.</p>
<h2>2. Secondary Storage Devices</h2>
<h3>A. Hard Disk Drive (HDD)</h3>
<p>Magnetic storage offering high capacity at an economical cost per gigabyte.</p>
<h3>B. Solid State Drive (SSD)</h3>
<p>Flash memory storage providing ultra-fast read/write speeds for modern operating systems.</p>
</body>
</html>
<title> tag resides inside the <head> section and is displayed on the browser tab, window bar, and search engine results snippet. The <h1> tag resides inside the <body> and represents the main visible heading on the actual webpage.
<h1> through <h6>) are block-level elements. They always start on a new line and expand across the full available width of their parent container.
<h1> tag (e.g., <h1><a href="index.htm">Site Title</a></h1>) is completely valid in HTML and is frequently used for site logos and headers.
font-size, color, font-family, line-height, and text-transform. Learn more in our HTML With CSS Tutorial.