Headings & Paragraphs
<h1> through <h6>), paragraph text blocks (<p>), line breaks (<br>), horizontal rules (<hr>), white space collapsing, and document outline SEO best practices.
HTML provides 6 levels of headings. <h1> represents the most important top-level page heading, while <h6> is the lowest sub-heading:
<h1>Heading 1 โ Main Page Title</h1>
<h2>Heading 2 โ Major Section Title</h2>
<h3>Heading 3 โ Subsection Title</h3>
<h4>Heading 4 โ Sub-subsection Title</h4>
<h5>Heading 5 โ Minor Header</h5>
<h6>Heading 6 โ Lowest Level Header</h6>
- Use exactly one <h1> per page: Reserve
<h1>for the main title of your webpage. - Do not skip levels: Do not jump from
<h2>directly to<h4>. Maintain sequential nesting. - Do not use headings for text sizing: Use headings for structural meaning, not to make text big or bold. Use CSS for visual styling!
Paragraphs are defined using the <p> tag. Browsers automatically add vertical margin before and after every paragraph block.
White Space Collapsing: HTML browsers automatically collapse multiple consecutive spaces, tabs, and line breaks into a single space character:
<!-- Browser renders this with single space between words -->
<p>
This text has multiple spaces
and multi-line breaks in code.
</p>
Line Break (<br>): Forces a line break within a paragraph without starting a new paragraph block (e.g. addresses or poetry lines).
Horizontal Rule (<hr>): Represents a thematic break or transition between topics, rendered as a horizontal divider line.
<p>
Our Compiler HQ<br>
123 Tech Park Avenue<br>
San Francisco, CA
</p>
<hr>
<p>Next topic begins after the horizontal rule above.</p>
Q1: Should I use <br> tags to create vertical space between paragraphs?
No! Do not stack multiple <br><br><br> tags to create layout spacing. Use CSS margins and padding for layout spacing instead.