HTML — Lesson 2
Headings & Paragraphs
Structuring text content on a page.
Headings & Paragraphs
HTML provides six levels of headings and the paragraph tag for organizing text content.
Heading Levels
Use <h1> through <h6> to define headings. <h1> is the most important, <h6> the least.
<h1>Main Title</h1>
<h2>Section Title</h2>
<h3>Subsection Title</h3>
<h4>Minor Title</h4>
<h5>Small Title</h5>
<h6>Tiny Title</h6>
Paragraphs
The <p> tag defines a paragraph. Browsers automatically add space before and after each paragraph.
<p>This is a paragraph of text. It can contain multiple sentences and words. Browsers will wrap the text automatically.</p>
<p>This is another paragraph. Notice the space between paragraphs.</p>
Line Breaks
Use <br> to insert a line break within a paragraph. It is a self-closing tag (no closing tag needed).
<p>First line<br>Second line</p>
Horizontal Rules
The <hr> tag creates a thematic break or horizontal line, often used to separate content sections.
<h2>Section One</h2>
<p>Content here.</p>
<hr>
<h2>Section Two</h2>
<p>More content.</p>
Best Practices
- Use only one
<h1>per page (the main title) - Follow heading hierarchy: h1 → h2 → h3, don't skip levels
- Keep paragraphs focused on a single topic
- Use
<br>sparingly - use CSS for spacing when possible
Tip: Search engines use headings to understand the structure of your content. A well-structured heading hierarchy improves SEO!
Practice what you learned in the Deoit Editor — a free, browser-based code editor.
Open Editor →