HTML Headings and Paragraphs
> Create readable page content with heading levels, paragraphs, line breaks, thematic breaks, and preformatted text.
**Cyber Code Academy · HTML Tutorial · Lesson 06 · Beginner**
## 1. Why headings matter
Headings describe the organization of a page. They help readers scan content and help assistive technologies navigate sections. HTML has six heading levels, from h1 (highest level) to h6 (lowest level).
## 2. Heading syntax
“`html
Frontend Development
HTML
HTML Basics
CSS
CSS Selectors
“`
The h1 identifies the main heading in this example. The h2 elements introduce major sections; h3 elements identify subsections.
A page’s heading structure should describe the content hierarchy. Do not choose h4 simply because its default size looks attractive. Use CSS for visual sizing.
## 3. Use headings logically
A sensible outline might be:
“`text
HTML Tutorial h1
Introduction h2
Document Structure h2
The head element h3
The body element h3
HTML Forms h2
Input types h3
“`
Avoid skipping levels when doing so would make the document outline confusing. A page can contain headings in different semantic regions, but keep the content structure understandable.
## 4. Paragraph element
The p element represents a paragraph:
“`html
HTML describes the structure of a web page.
CSS controls its presentation.
“`
Browsers display paragraphs as blocks and normally add space around them. Do not use multiple empty paragraphs to create layout spacing.
## 5. Line breaks with br
The br element creates a line break inside text when the break is part of the content, such as a postal address or a poem:
“`html
Cyber Code Academy
Gwalior, Madhya Pradesh
India
“`
Do not use dozens of br elements to push sections down the page. CSS margins, padding, and layout properties are the right tools for visual spacing.
## 6. Thematic break with hr
The hr element represents a thematic change or separation between paragraphs or sections:
“`html
Morning Session
We learn HTML fundamentals.
Afternoon Session
We build a small page.
“`
## 7. Preformatted text
The pre element preserves whitespace and line breaks. It is commonly combined with code to display source code:
“`html
line one
line two is indented
line three
“`
Use pre for text where whitespace is meaningful, not to create a general page layout.
## 8. Default appearance versus meaning
Browsers have default styles for h1, h2, p, and other elements. These styles are not the definition of their meaning. A heading can be styled to be small; a paragraph can be styled to look large. Pick elements based on meaning, then use CSS for presentation.
## 9. Common mistakes
– Using heading elements to make text bold or large.
– Using several h1 elements without understanding the page structure.
– Skipping heading levels without a good reason.
– Using br for visual spacing.
– Using hr only as a decorative line when no thematic break exists.
– Placing block elements in invalid contexts.
## 10. Practice project: course outline
Build an HTML page with:
– One main h1 heading.
– Three h2 section headings.
– At least two h3 subheadings.
– Two paragraphs under each major section.
– One address that uses br correctly.
– One hr separating two different topics.
– One pre/code example.
## 11. Knowledge check
1. How many heading levels are available in HTML?
2. What is the purpose of h1 versus h2?
3. What does p represent?
4. When should br be used?
5. What does hr communicate?
6. Why should CSS control visual font sizes?
## Summary
Headings provide hierarchy; paragraphs group sentences into readable blocks; br represents a content line break; hr marks a thematic break; pre preserves whitespace.
**Next lesson:** HTML Text Formatting and Semantic Text.
Want to learn this professionally?
Explore practical IT training at Cyber Code Academy.
View Academy Courses