Paragraphs & Headings in HTML
Paragraphs and headings form the backbone of web content. They help organize information, improve readability, and provide structure for both users and search engines.
HTML Paragraphs
Paragraphs are defined using the <p>
tag. They are used to group sentences together into meaningful blocks of text.
<p>This is a paragraph of text in HTML.</p>
Browsers automatically add space above and below paragraphs to separate them from other content.
HTML Headings
Headings are used to define titles and subtitles. HTML offers six levels of headings, from <h1>
(most important) to <h6>
(least important).
<h1>Main Title</h1>
<h2>Subheading</h2>
<h3>Section Title</h3>
Use headings in order to structure your content hierarchically and semantically.
Best Practices
- Use
<p>
for all text blocks, not just line breaks. - Start each page with one
<h1>
as the main title. - Donβt skip heading levels (e.g.,
<h1>
directly to<h4>
). - Use headings consistently for better accessibility and SEO.
Conclusion
Paragraphs and headings are fundamental HTML elements that help convey structure and meaning. By using them correctly, you create content that is easy to read, accessible, and search engine-friendly.