Headlines Aren’t Just Big Text: How <h1>
to <h6>
Secretly Run Your Website with html headings
Remember textbooks with chaotic, endless paragraphs? Yeah, nobody read those. That’s why headings exist – they’re your content’s tour guides. In HTML, we’ve got six magical tags: <h1>
through <h6>
. But here’s the kicker – they’re not just about font size. They whisper secrets to Google and shout directions to screen readers. Let’s crack their code together using html headings.
(True story: I once used <h4>
for a main heading because “it looked nicer.” My SEO guy still mocks me at parties.)
1. Heading Tags Unmasked
Understanding the structure of html headings is crucial for both SEO and user experience. These aren’t styling tools – they’re hierarchy ninjas:
<h1>Godfather of Content</h1> <!-- One per page! -->
<h2>Main Crew Members</h2>
<h3>Lieutenants</h3>
<h4>Foot Soldiers</h4> <!-- Rarely seen this deep -->
<h5>Informants</h5>
<h6>That guy who knows a guy</h6>
The dirty truth:
<h1>
is your page’s headline act (like a book title)- Each number down = one level deeper in importance
- Default sizes? Just starting points – we’ll transform them completely with CSS later
Pro tip from my fails: Never use<h6>
unless you’re writing legal disclaimers. Or ransom notes.
2. Why Your Headings Need Therapy
Visual readers:
<!-- Without headings -->
<p>Welcome to our store... products... sale... contact...</p> <!-- Zzz... -->
<!-- With headings -->
<h1>Unicorn Tears Coffee</h1>
<h2>Why our coffee rules</h2>
<h2>Best sellers</h2> <!-- Eyes naturally jump here! -->
Invisible impacts:
- Screen readers: Jump between headings like Mario on mushrooms
- Google: Treats your
<h2>
s like chapter titles in your page’s “book” - Your sanity: Finding sections in code becomes 10x easier
My wake-up call: Forgot headings on a client’s site. Their bounce rate looked like a ski slope.
3. The <h1>
Commandments (Break These = Digital Sin)
Rule #1: ONE <h1>
per page. Period.
(Unless you’re using fancy semantic sections – but baby steps!)
Good citizen:
<h1>How to Bake Sourdough</h1> <!-- King of the page -->
<h2>Ingredients</h2>
<h2>Method</h2>
Digital felon:
<h1>Baking Tips</h1>
<h1>Sourdough Recipe</h1> <!-- Google: "Pick a lane, buddy!" -->
<h1>About Me</h1>
Rule #2: Never skip ranks like a rebellious teen:
<h1>Main Title</h1>
<h3>Suddenly Deeper</h3> <!-- Screen reader: "WTF?!" -->
4. Real-World Heading Blueprint
Let’s build a cooking guide properly:
<h1>Spaghetti Carbonara for Dummies</h1> <!-- The boss -->
<h2>Why This Beats Ramen</h2> <!-- Section 1 -->
<p>Convincing argument...</p>
<h2>Ingredients</h2> <!-- Section 2 -->
<h3>Essential Stuff</h3> <!-- Subsection -->
<h3>Fancy Upgrades</h3>
<h2>Steps to Glory</h2> <!-- Section 3 -->
<h3>Prep Work</h3>
<h3>Cooking Magic</h3>
<h4>Pro Timing Tip</h4> <!-- Rare h4 cameo! -->
<h2>Common Disasters</h2> <!-- Section 4 -->
<h3>Eggs Scrambled? Weep Here</h3>
See how the hierarchy tells a story? Like a cookbook’s table of contents!
5. Accessibility: Why Screen Readers Care
Imagine navigating a page blindfolded. Headings are your guardrails:
<!-- Good -->
<h1>National Parks Guide</h1>
<h2>Yosemite</h2> <!-- Screen reader: "Heading level 2" -->
<h3>Hiking Trails</h3>
<!-- Nightmare -->
<div class="big-title">Yellowstone</div> <!-- Screen reader: "Text block" -->
True horror story: I once audited a site that used 42 <h2>
tags. The screen reader sounded like a broken auctioneer.
6. Styling Without Betrayal
Want pretty headings? CSS is your spray painter:
h1 {
font-family: 'Comic Sans', cursive; /* Fight me */
color: #f00; /* Emergency red */
text-shadow: 2px 2px 4px #999; /* Fancy! */
}
h2 {
font-size: 1.8rem; /* No more tiny h2s! */
border-bottom: 2px dashed purple; /* Why not? */
}
Golden rule: Style with CSS, structure with HTML. Never use <h4>
because “it looks better than <h2>
.”
7. Your 5-Minute Heading Workout
- Create
headings.html
- Paste this crime scene:
<h1>My Boring Page</h1>
<p>Welcome...</p>
<h4>Products</h4> <!-- Criminal! -->
<h2>About</h2>
- Fix it:
- Demote
<h4>
to<h2>
- Add an
<h3>
under “About” - Make “Products” an
<h2>
- Demote
- Save → Refresh → Admire your semantic glow-up
Why This Matters More Than You Think
Headings aren’t decoration – they’re UX foundation. Good structure:
→ Makes Google fall in love with your content
→ Helps visually impaired users actually navigate
→ Prevents you from crying during redesigns
“Bad headings are like bad road signs – everyone gets lost, but nobody admits it.”
-My navigationally-challenged coworker
Your Assignment:
- Create
headings-fix.html
- Copy the broken code below
- Repair the hierarchy by:
- Keeping only ONE
<h1>
(choose the most important title) - Converting misplaced headings to proper levels
- Ensuring logical order (no skipping levels!)
- Keeping only ONE
- Add 1 new
<h2>
and 2<h3>
sections about your favorite space topic
<!-- YOUR MISSION: FIX THIS HEADING HIERARCHY CRIME SCENE -->
<h1>Space Exploration Guide</h1>
<h3>Chapter 1: The Moon Landing</h3>
<h4>1.1 Apollo Missions</h4>
<h2>Chapter 2: Mars Colonization</h2>
<h5>2.1 Challenges</h5>
<h1>Chapter 3: Beyond Our Solar System</h1>
Solution Snippet:
<h1>Space Exploration Milestones</h1> <!-- Only h1! -->
<h2>Chapter 1: The Moon Landing</h2> <!-- Promoted from h3 -->
<h3>Apollo Missions</h3> <!-- Promoted from h4 -->
<h2>Chapter 2: Mars Colonization</h2>
<h3>Technical Challenges</h3> <!-- Promoted from h5 -->
<h2>Chapter 3: Beyond Our Solar System</h2> <!-- Demoted from h1 -->
<!-- NEW CONTENT -->
<h2>Why Saturn's Moon Titan Fascinates Me</h2>
<h3>Methane Lakes Discovery</h3>
<h3>Potential for Life</h3>