HTML Headings
Master this topic with zero to advance depth.
Expert Answer & Key Takeaways
Mastering HTML Headings is essential for high-fidelity technical architecture and senior engineering roles in 2026.
HTML Headings
HTML headings are defined with the
<h1> to <h6> tags. <h1> defines the most important heading. <h6> defines the least important heading.<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<h4>Heading 4</h4>
<h5>Heading 5</h5>
<h6>Heading 6</h6>Note: Browsers automatically add some white space (a margin) before and after a heading.
Headings Are Important
Search engines use headings to index the structure and content of your web pages. Users often skim a page by its headings. It is important to use headings to show the document structure.
<h1>headings should be used for main headings, followed by<h2>headings, then the less important<h3>, and so on.
Note: Use HTML headings for headings only. Don't use headings to make text BIG or bold. For visual size changes, use CSS.
Bigger Headings
Each HTML heading has a default size. However, you can specify the size for any heading with the
style attribute, using the CSS font-size property:<h1 style="font-size:60px;">Heading 1</h1>The HTML <hr> Tag
The
<hr> tag defines a thematic break in an HTML page, and is most often displayed as a horizontal rule. The <hr> element is used to separate content (or define a change) in an HTML page:<h1>This is a heading</h1>
<p>This is some text.</p>
<hr>
<h2>This is a sub-heading</h2>
<p>This is some more text.</p>The
<hr> tag is an empty tag, which means that it has no end tag.💡 Interactive Task
Try building a small outline for a story using
<h1> for the title, <h2> for chapters, and <h3> for scene titles. See how the visual hierarchy helps the reader!Interview Corner
❓ Interview Question
Q: Why are headings important for SEO?
A: Search engines (like Google) use heading tags to understand the structure of your content and identify the main topics of your page. Proper use of
<h1> is a key ranking factor.❓ Interview Question
Q: Should I use multiple
<h1> tags on one page?A: No. You should use exactly one
<h1> for the main topic of the page to keep the hierarchy clear for search engines and screen readers.❓ Interview Question
Q: Does the
<hr> tag need a closing tag?A: No,
<hr> is an empty element. It represents a horizontal line used as a thematic divider and does not wrap any content.Course4All Engineering Team
Verified ExpertFrontend Architects
Focused on accessibility, semantic structure, and modern SEO, our frontend team ensures the HTML/CSS curriculum meets 2026 professional standards.
Pattern: 2026 Ready
Updated: Weekly
Found an issue or have a suggestion?
Help us improve! Report bugs or suggest new features on our Telegram group.