<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: John Njuguna</title>
    <description>The latest articles on DEV Community by John Njuguna (@johndon).</description>
    <link>https://dev.to/johndon</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4000060%2Fa0e28a59-0bd4-489f-9cb3-a2978bb9b40a.png</url>
      <title>DEV Community: John Njuguna</title>
      <link>https://dev.to/johndon</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/johndon"/>
    <language>en</language>
    <item>
      <title>Semantic HTML &amp; Accessibility: What I Learned as a Beginner</title>
      <dc:creator>John Njuguna</dc:creator>
      <pubDate>Wed, 24 Jun 2026 07:58:07 +0000</pubDate>
      <link>https://dev.to/johndon/semantic-html-accessibility-what-i-learned-as-a-beginner-3nl2</link>
      <guid>https://dev.to/johndon/semantic-html-accessibility-what-i-learned-as-a-beginner-3nl2</guid>
      <description>&lt;p&gt;I am two weeks into my web development journey at the IYF Weekend Academy &lt;br&gt;
Season 11, and this week I learned something that completely changed how &lt;br&gt;
I think about writing HTML — semantic HTML and accessibility.&lt;/p&gt;
&lt;h2&gt;
  
  
  What is Semantic HTML?
&lt;/h2&gt;

&lt;p&gt;Semantic HTML means using the RIGHT tag for the RIGHT purpose. Before I &lt;br&gt;
learned this, I thought all HTML tags were the same. I used to write &lt;br&gt;
everything inside &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; tags. But that is wrong!&lt;/p&gt;

&lt;p&gt;Here is an example of non-semantic HTML:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"header"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"nav"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"nav-item"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Home&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"nav-item"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;About&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"main"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"title"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Welcome&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"text"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;This is my site...&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"footer"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;© 2026&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
` ``

Here is the same code written with semantic HTML:

` ``html
&lt;span class="nt"&gt;&amp;lt;header&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;nav&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"index.html"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Home&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"about.html"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;About&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/nav&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/header&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;main&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;Welcome&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;This is my site...&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/main&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;footer&amp;gt;&lt;/span&gt;© 2026&lt;span class="nt"&gt;&amp;lt;/footer&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The second version is cleaner, easier to read, and tells the browser &lt;br&gt;
exactly what each part of the page is for.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Does it Matter?
&lt;/h2&gt;

&lt;p&gt;Semantic HTML matters for three reasons:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Screen Readers&lt;/strong&gt; — People who are blind use screen readers to &lt;br&gt;
browse the internet. A screen reader can understand &lt;code&gt;&amp;lt;nav&amp;gt;&lt;/code&gt; and tell &lt;br&gt;
the user "this is a navigation menu". It cannot do that with &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Search Engines&lt;/strong&gt; — Google understands semantic HTML better. &lt;br&gt;
A page with proper headings and structure ranks better in search results.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Other Developers&lt;/strong&gt; — When someone else reads your code, semantic &lt;br&gt;
HTML makes it much easier to understand what each section does.&lt;/p&gt;

&lt;h2&gt;
  
  
  Accessibility Issues I Found
&lt;/h2&gt;

&lt;p&gt;When I audited my portfolio page using Chrome Lighthouse, I found these issues:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Issue 1 — Generic image alt text&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
I had written &lt;code&gt;alt="Profile placeholder image"&lt;/code&gt; which is too vague. &lt;br&gt;
I fixed it to &lt;code&gt;alt="John Kariuki profile photo"&lt;/code&gt; which is more descriptive &lt;br&gt;
for screen readers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Issue 2 — Wrong heading order&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
I jumped from &lt;code&gt;&amp;lt;h1&amp;gt;&lt;/code&gt; straight to &lt;code&gt;&amp;lt;h3&amp;gt;&lt;/code&gt;, skipping &lt;code&gt;&amp;lt;h2&amp;gt;&lt;/code&gt;. This confuses &lt;br&gt;
screen readers. I fixed it by changing &lt;code&gt;&amp;lt;h3&amp;gt;&lt;/code&gt; to &lt;code&gt;&amp;lt;h2&amp;gt;&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Issue 3 — Missing lang attribute&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
I forgot to add &lt;code&gt;lang="en"&lt;/code&gt; to my &lt;code&gt;&amp;lt;html&amp;gt;&lt;/code&gt; tag. This tells the browser &lt;br&gt;
what language the page is in. A small fix with a big impact!&lt;/p&gt;

&lt;h2&gt;
  
  
  My Lighthouse Score
&lt;/h2&gt;

&lt;p&gt;After fixing these issues my Lighthouse accessibility score improved. &lt;br&gt;
Running the audit and seeing the score go up felt really satisfying!&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

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

&lt;p&gt;You can see my live portfolio here:&lt;br&gt;&lt;br&gt;
&lt;a href="https://helter-skelter254.github.io/iyf-s11-week-01-helter-skelter254/" rel="noopener noreferrer"&gt;https://helter-skelter254.github.io/iyf-s11-week-01-helter-skelter254/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>a11y</category>
      <category>beginners</category>
      <category>html</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
