HTML
Headings and Paragraphs
Structure Alex's portfolio content with heading hierarchy and paragraph text that search engines and screen readers understand.
Every website needs structure. Think of a newspaper — it has headlines, subheadings, and body text. HTML gives you the same tools. Headings create hierarchy and importance. Paragraphs hold your main content. Search engines read your headings to understand what your page covers. Screen readers jump between headings to help visually impaired users navigate. And browsers apply default styling that makes content instantly readable.Heading Tag Anatomy
HTML provides six heading levels — fromh1 to h6. Here's how they break apart:
h1 is biggest and most important. h6 is smallest. Most websites only use h1 through h3.
The Six Heading Levels
Alex wants to add proper headings to their portfolio homepage. Let's see all six heading levels in action:<!-- Alex's portfolio homepage with heading hierarchy -->
<h1>Alex Chen - Web Developer</h1>
<h2>About Me</h2>
<h3>My Background</h3>
<h4>Education</h4>
<h5>Certifications</h5>
<h6>Additional Training</h6>What just happened?
The browser automatically styled each heading smaller than the last. h1 got the biggest text and most spacing. h6 is barely bigger than normal text. Try this: inspect the headings in your browser developer tools to see the default font sizes.
Heading Hierarchy Rules
You can't just pick heading numbers randomly. There's a logical order: - Use only oneh1 per page
- Never skip levels (don't go h1 → h3)
- Think of them like a book outline
- Search engines use this structure
Common Mistake
Don't choose headings by size. Choose by importance. If you want smaller text, use CSS later. The HTML structure matters more than appearance.
Paragraph Basics
Thep tag wraps blocks of text. Every paragraph gets its own p element. Browsers add spacing above and below each paragraph automatically.
Alex needs to write an "About Me" section for their portfolio:
<!-- About section for Alex's portfolio -->
<h1>About Alex Chen</h1>
<p>I'm a web developer based in Seattle with a passion for creating user-friendly websites.</p>
<p>I started coding three years ago and fell in love with problem-solving through technology.</p>
<p>When I'm not coding, you'll find me hiking or trying new coffee shops around the city.</p>What just happened?
Each paragraph got wrapped in margins — space above and below. The browser treats each p as a separate block of content. Try this: add more paragraphs and watch the spacing grow between them.
Real Portfolio Structure
Let's combine headings and paragraphs into something that looks like a real portfolio homepage. Alex wants sections for their intro, skills, and contact info:<!-- Complete homepage structure for Alex's portfolio -->
<h1>Alex Chen</h1>
<p>Full-Stack Web Developer</p>
<h2>Welcome</h2>
<p>I build modern websites that help businesses grow online. Every project starts with understanding your goals.</p>
<h2>Skills</h2>
<h3>Frontend Development</h3>
<p>HTML, CSS, and JavaScript to create responsive user interfaces.</p>
<h3>Backend Development</h3>
<p>Node.js and databases to power dynamic web applications.</p>
<h2>Get In Touch</h2>
<p>Ready to start your next project? Let's talk about how I can help.</p>h1 stands out as the page title. h2 elements mark major sections. h3 creates subsections under Skills.
Empty Lines Don't Create Paragraphs
A common mistake — thinking empty lines in your HTML create paragraph breaks. They don't. Watch:<!-- Wrong way - empty lines don't work -->
This is the first paragraph.
This looks like a second paragraph but it's not.
Even multiple empty lines don't help.
<!-- Right way - use p tags -->
<p>This is the first paragraph.</p>
<p>This is actually a second paragraph.</p>p tags created actual paragraph breaks with spacing.
SEO and Accessibility Benefits
Proper headings and paragraphs aren't just for looks. They solve real problems:Search Engines
Google reads your h1 to understand what your page is about. Proper heading order helps rankings.
Screen Readers
Visually impaired users jump between headings to navigate. Skip heading levels and you break their experience.
Reading Flow
Paragraphs create visual breaks. Readers can scan your content instead of facing a wall of text.
Code Organization
Clear structure makes your HTML easier to edit later. Other developers can understand your code faster.
h1 to h3. The structure flows logically.
Line Breaks vs Paragraphs
Sometimes you want a line break without paragraph spacing. HTML has thebr tag for this. But use it carefully.
<!-- Address formatting in Alex's contact section -->
<h2>Contact Info</h2>
<p>Alex Chen<br>
Web Developer<br>
Seattle, WA</p>
<p>This is a separate paragraph with normal spacing.</p>br tag is self-closing — no closing tag needed. It forces a line break right where you put it. Perfect for addresses, poems, or any content where line breaks matter.
Pro tip: Don't use br to create spacing between paragraphs. Use proper p tags instead. Save br for content that actually needs line breaks.
Complete Portfolio Example
Here's a final example showing everything together. Alex's complete homepage with proper structure:<!-- Alex's complete portfolio homepage -->
<h1>Alex Chen</h1>
<p>Frontend Developer specializing in modern web technologies</p>
<h2>About Me</h2>
<p>I create websites that work beautifully on every device. My focus is clean code and great user experiences.</p>
<p>Three years of experience building sites for small businesses and startups.</p>
<h2>Recent Projects</h2>
<h3>Coffee Shop Website</h3>
<p>Responsive site with online ordering and location finder.</p>
<h3>Startup Landing Page</h3>
<p>High-converting page that increased signups by 40%.</p>h1 for the page title. h2 elements for major sections. h3 for project subsections. Each paragraph holds one complete thought.
This HTML structure works for screen readers, search engines, and future developers who need to edit the code. And it looks professional in any browser without any CSS styling.
Quiz
Alex wants to add headings to their portfolio. What's the rule about h1 tags?
Which HTML creates two separate paragraphs with proper spacing?
Alex finds h3 too big for a section title. What should they do?
Next: Comments and Whitespace
Learn how to add notes to your code and understand how browsers handle spaces and line breaks.