
Understand WCAG
WCAG is a set of guidelines developed by the World Wide Web Consortium (W3C) to ensure that web content is perceivable, operable, understandable, and robust for all users.
In the digital age, web accessibility has become increasingly important, ensuring that websites are usable by everyone, including those with disabilities, is not just a moral imperative but also a legal requirement in many jurisdictions. In this article, we will delves into practical ways to infuse accessibility into your HTML and CSS code, empowering you to build websites that embrace diversity and inclusion. Let’s get started!
1. HTML – Semantic Structure with Headings
Proper heading structure (H1 – H6) enhances navigation and screen reader comprehension.
Example:
<h1>Level 1 Header - Welcome to UI Pencil</h1>
<h2>Level 2 Header - Explore WCAG</h2>
<h3>Level 3 Header - 1. Headings and Labels</h3>
2. HTML – Clear Labels for Every Form Control
Link the <label> element to the corresponding form element using the for attribute. The value of the for attribute should match the id attribute of the form element.
Example:
<label for="firstname">First Name</label>
<input id="firstname" type="text" name="firstname">
3. HTML – Descriptive Alternative Text (Alt Text)
Provides text alternatives for images, ensuring content is accessible for users who cannot see them. the text must be clear and meaningful.
Example:
<img src="barchart.jpg" alt="A bar chart showing revenue growth over the year 2023" />
For decorative icon, include an empty alt attribute to indicate that the image is purely decorative and doesn’t convey any meaningful content. This informs screen readers to ignore the image.
<img src="phone.jpg" alt="" /><label>Mobile No.</label>
4. HTML – Language Identification:
Helps screen readers pronounce content correctly and facilitates translation.
Example:
<html lang="en">
4. CSS – Focus Indicators
Makes keyboard navigation clear for users who cannot rely on a mouse.
Example:
a:focus { outline: 3px solid blue; }
4. CSS – Visual Clarity
Avoids relying solely on color to convey information, making content accessible for users with vision deficit, for e.g. color blindness
Example:
.error {
color: #f00;
background: #fff; /*ensure color contrast*/
border: 1px solid #f00; /* Additional visual cue */ }
To check whether a webpage is usable by people with color blindness, we can utilize the built-in Chrome console tool, here is how to do it:
- Open the Chrome DevTools (Ctrl + Shift + J on Windows/Linux/ChromeOS or Command + Option + J on Mac).
- Click on the three vertical dots menu in the top right corner of the DevTools window.
- Select More tools from the menu.

- Choose Rendering from the submenu.

By default, ‘No emulation’ is selected. To simulate different versions of vision deficiencies, select difference options from the dropdown list.
5. HTML + CSS – Responsive Design
Accommodates different screen sizes and devices, ensuring usability for everyone.
Example:
@media (max-width: 768px) {
/* CSS code for max-width: 768px*/
}
Conclusion
By thoughtfully applying these HTML and CSS techniques, you can create websites that embrace diversity and welcome users of all abilities. Remember, accessibility is an ongoing journey, and continuous learning and testing are crucial for crafting truly inclusive digital experiences. Happy Coding! ![]()



Leave a comment