惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
DataBreaches.Net
MongoDB | Blog
MongoDB | Blog
GbyAI
GbyAI
L
LangChain Blog
B
Blog
博客园 - 三生石上(FineUI控件)
Martin Fowler
Martin Fowler
博客园 - 【当耐特】
Recent Announcements
Recent Announcements
P
Proofpoint News Feed
U
Unit 42
Last Week in AI
Last Week in AI
WordPress大学
WordPress大学
有赞技术团队
有赞技术团队
雷峰网
雷峰网
Microsoft Security Blog
Microsoft Security Blog
T
The Blog of Author Tim Ferriss
爱范儿
爱范儿
小众软件
小众软件
I
InfoQ
G
Google Developers Blog
大猫的无限游戏
大猫的无限游戏
人人都是产品经理
人人都是产品经理
C
Check Point Blog

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Semantic HTML & Accessibility: What I Learned as a Beginner
John Njuguna · 2026-06-24 · via DEV Community

John Njuguna

I am two weeks into my web development journey at the IYF Weekend Academy
Season 11, and this week I learned something that completely changed how
I think about writing HTML — semantic HTML and accessibility.

What is Semantic HTML?

Semantic HTML means using the RIGHT tag for the RIGHT purpose. Before I
learned this, I thought all HTML tags were the same. I used to write
everything inside <div> tags. But that is wrong!

Here is an example of non-semantic HTML:

<div class="header">
    <div class="nav">
        <div class="nav-item">Home</div>
        <div class="nav-item">About</div>
    </div>
</div>
<div class="main">
    <div class="title">Welcome</div>
    <div class="text">This is my site...</div>
</div>
<div class="footer">© 2026</div>
` ``

Here is the same code written with semantic HTML:

` ``html
<header>
    <nav>
        <a href="index.html">Home</a>
        <a href="about.html">About</a>
    </nav>
</header>
<main>
    <h1>Welcome</h1>
    <p>This is my site...</p>
</main>
<footer>© 2026</footer>

The second version is cleaner, easier to read, and tells the browser
exactly what each part of the page is for.

Why Does it Matter?

Semantic HTML matters for three reasons:

1. Screen Readers — People who are blind use screen readers to
browse the internet. A screen reader can understand <nav> and tell
the user "this is a navigation menu". It cannot do that with <div>.

2. Search Engines — Google understands semantic HTML better.
A page with proper headings and structure ranks better in search results.

3. Other Developers — When someone else reads your code, semantic
HTML makes it much easier to understand what each section does.

Accessibility Issues I Found

When I audited my portfolio page using Chrome Lighthouse, I found these issues:

Issue 1 — Generic image alt text

I had written alt="Profile placeholder image" which is too vague.
I fixed it to alt="John Kariuki profile photo" which is more descriptive
for screen readers.

Issue 2 — Wrong heading order

I jumped from <h1> straight to <h3>, skipping <h2>. This confuses
screen readers. I fixed it by changing <h3> to <h2>.

Issue 3 — Missing lang attribute

I forgot to add lang="en" to my <html> tag. This tells the browser
what language the page is in. A small fix with a big impact!

My Lighthouse Score

After fixing these issues my Lighthouse accessibility score improved.
Running the audit and seeing the score go up felt really satisfying!

Final Thoughts

I used to think accessibility was something advanced developers worried
about. But these fixes took less than 10 minutes and made my site better
for everyone. If you are just starting out like me, start writing semantic
HTML from day one — it is a habit worth building early.