Lesson 34 of 55 · HTML
Text Formatting Tags
Duration: 9 min
Text Formatting Tags
Block‑level headings
<h1>Page Title</h1>
<h2>Section Heading</h2>
<h3>Sub‑section</h3>
Only one <h1> should appear per page; it represents the main topic. Subsequent headings build a logical hierarchy used by browsers, screen readers, and search engines.
Paragraphs and line breaks
<p>This is a paragraph. It automatically has margin before and after.</p>
<p>Another paragraph.</p>
<p>Line break within a paragraph using <br /> tag.</p>
Avoid using <br> for spacing; rely on CSS margins instead.
Horizontal rule
<hr />
Use <hr> to separate thematic sections. For visual lines, use CSS borders for more styling flexibility.
Additional block elements
<blockquote>– For quoted text.<pre>– Preserves whitespace and uses a monospace font.<address>– Contact information for the author or site.
Tip: Keep HTML focused on meaning; use CSS for all visual styling (spacing, borders, colors).