Menu

Semantic HTML and Accessibility: What I Learned
📰

Semantic HTML and Accessibility: What I Learned

DEV Community: html·Faith·17 days ago
#22EKsUbb
#devto2#devto#dev#part#every
Reading 0:00
15s threshold

When I started building my portfolio, I made every part of the page with <div> tags. A <div> is just a box, and it doesn't tell the browser what is inside it.

Semantic HTML means using tags that describe what the content is, like <header> , <nav> , <main> and <footer> . People who are blind use screen readers, and these tags tell the reader what each part of the page is, so they can jump straight to the menu or the main content. Search engines also understand the page better, and the code is easier to read.

Alt text is another important part. It is a short description inside an image tag. Without it, a screen reader has nothing meaningful to read, so a blind person misses what the image shows.

Before and after

<div class= "header" > <div class= "nav" > ... </div> </div> <div class= "main" > <div class= "article" > ... </div> </div>

Enter fullscreen mode

Exit fullscreen mode

<header> <nav> ... </nav> </header> <main> <article> ...…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.