HTML Basics
HTML Headings
Master HTML headings from h1 to h6, their importance for SEO and accessibility.
HTML Headings
HTML headings are defined with the <h1> to <h6> tags. <h1> defines the most important heading. <h6> defines the least important heading.
Headings are important for:
- SEO: Search engines use headings to index content
- Accessibility: Screen readers use headings for navigation
- Structure: Clear document hierarchy
Heading Hierarchy
You should only have one `<h1>` per page — it describes the main topic. Use <h2> through <h6> to create a logical document outline:
<h1>— Page title (use only once)<h2>— Major sections<h3>— Sub-sections<h4>,<h5>,<h6>— Further sub-divisions
Headings Create Structure
Each heading creates an implicit section in your document. Never skip heading levels — don't jump from <h1> to <h3> without an <h2> in between.
Example
html
<!DOCTYPE html>
<html lang="en">
<body>
<h1>Main Page Title (H1)</h1>
<p>Introduction paragraph...</p>
<h2>First Major Section (H2)</h2>
<p>Section content...</p>
<h3>Sub-section (H3)</h3>
<p>Sub-section content...</p>
<h3>Another Sub-section (H3)</h3>
<p>More content...</p>
<h2>Second Major Section (H2)</h2>
<p>Second section content...</p>
</body>
</html>Try it yourself — HTML