<?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: Caroline-wanjira</title>
    <description>The latest articles on DEV Community by Caroline-wanjira (@carolinewanjira).</description>
    <link>https://dev.to/carolinewanjira</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%2F4186961%2F78e5d611-42c2-4887-9da7-5f06b04d94be.png</url>
      <title>DEV Community: Caroline-wanjira</title>
      <link>https://dev.to/carolinewanjira</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/carolinewanjira"/>
    <language>en</language>
    <item>
      <title>Semantic HTML &amp; Accessibility: what I learned and fixed</title>
      <dc:creator>Caroline-wanjira</dc:creator>
      <pubDate>Thu, 15 Oct 2026 14:16:54 +0000</pubDate>
      <link>https://dev.to/carolinewanjira/why-sematic-html-matters-what-lighthouse-audit-taught-me-3kng</link>
      <guid>https://dev.to/carolinewanjira/why-sematic-html-matters-what-lighthouse-audit-taught-me-3kng</guid>
      <description>&lt;h1&gt;
  
  
  Semantic HTML and Accessibility : what I learned and fixed
&lt;/h1&gt;

&lt;p&gt;I'm learning web development, and I recently ran a Google Chrome Lighthouse audit on my index.html page. The experience showed me how the HTML tags I choose affect real people, not just how a page looks.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Is Semantic HTML?
&lt;/h2&gt;

&lt;p&gt;Semantic HTML means using HTML elements that describe the meaning and purpose of their content, such as &lt;code&gt;&amp;lt;header&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;nav&amp;gt;&lt;/code&gt;, and &lt;code&gt;&amp;lt;main&amp;gt;&lt;/code&gt;, instead of using generic &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; elements for everything.&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Accessibility:&lt;/strong&gt; Screen readers use HTML landmarks to help users navigate different sections of a webpage.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Search engine optimization:&lt;/strong&gt; Meaningful HTML structure helps search engines understand the content of a page.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Code readability:&lt;/strong&gt; Semantic elements make code easier for developers to read, understand, and maintain.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Before and After: Semantic HTML
&lt;/h2&gt;

&lt;p&gt;Before using semantic HTML, a page might rely heavily on generic &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; elements.&lt;/p&gt;

&lt;h3&gt;
  
  
  Before: Non-Semantic HTML
&lt;/h3&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;"menu"&lt;/span&gt;&lt;span class="nt"&gt;&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;"content"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Although this code can work, the elements do not clearly communicate the purpose of each section.&lt;/p&gt;

&lt;h3&gt;
  
  
  After: Semantic HTML
&lt;/h3&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;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;/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;/main&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This structure makes the purpose of each section clearer and provides useful landmarks for assistive technologies.&lt;/p&gt;

&lt;h2&gt;
  
  
  Issues I Found and How I Fixed Them
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Missing Main Landmark
&lt;/h3&gt;

&lt;p&gt;Lighthouse identified that my page was missing a &lt;code&gt;&amp;lt;main&amp;gt;&lt;/code&gt; element.&lt;/p&gt;

&lt;p&gt;I fixed this by wrapping the primary content of my webpage inside a &lt;code&gt;&amp;lt;main&amp;gt;&lt;/code&gt; element. This helps screen-reader users identify the main content and navigate the page more efficiently.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Incorrect Image Aspect Ratio
&lt;/h3&gt;

&lt;p&gt;Another issue involved an image's aspect ratio. Images that are stretched or displayed with incorrect proportions can affect the visual experience of a website.&lt;/p&gt;

&lt;p&gt;One way to make images responsive while preserving their natural proportions is to use CSS:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nt"&gt;img&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;max-width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;auto&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This allows images to shrink to fit their containers without being stretched vertically.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Missing Meta Description
&lt;/h3&gt;

&lt;p&gt;I also identified a missing meta description.&lt;/p&gt;

&lt;p&gt;A meta description provides a brief summary of a webpage's content and may appear in search engine results.&lt;/p&gt;

&lt;p&gt;I added a description inside the &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt; section of my HTML document.&lt;br&gt;
The description should accurately reflect the actual content of the page.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Result
&lt;/h2&gt;

&lt;p&gt;After making the changes, I ran the Lighthouse audit again to evaluate the improvements.&lt;/p&gt;

&lt;p&gt;My Accessibility score went from &lt;strong&gt;97%&lt;/strong&gt; to &lt;strong&gt;100%&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;This experience helped me understand that website quality involves more than visual appearance. Accessibility, structure, and usability are also important parts of building a good website.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Learned
&lt;/h2&gt;

&lt;p&gt;Before running the audit, I mainly focused on how my website looked and whether its features worked as expected.&lt;/p&gt;

&lt;p&gt;However, I learned that small decisions, such as choosing appropriate HTML elements, can influence how people interact with a website.&lt;/p&gt;

&lt;p&gt;I'm beginning to understand that writing good HTML is not simply about making a page display correctly. It is also about making the page meaningful, accessible, and easier to navigate.&lt;/p&gt;

&lt;p&gt;As I continue learning web development, I want to pay more attention to semantic structure and accessibility when building websites.&lt;/p&gt;

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

&lt;p&gt;Running a Lighthouse audit gave me a practical way to identify areas where my portfolio could improve.&lt;/p&gt;

&lt;p&gt;As a beginner, I'm learning that building websites involves continuous testing, identifying problems, and making improvements.&lt;/p&gt;

&lt;p&gt;I still have a lot to learn, but this experience has encouraged me to think beyond appearance and consider the people who will actually use the websites I build.&lt;/p&gt;

&lt;p&gt;What was the first website improvement that taught you something important about web development?&lt;/p&gt;




&lt;h1&gt;
  
  
  javascript #html #webdev #accessibility #beginners
&lt;/h1&gt;

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