In this section, we will explore the first principle of accessible design: making content perceivable. This principle ensures that information and user interface components are presented in ways that users can perceive, regardless of their sensory abilities.
Key Concepts
-
Text Alternatives for Non-Text Content
- Provide text alternatives for images, icons, and other non-text content.
- Use
alt
attributes in HTML to describe images. - Ensure that text alternatives convey the same information as the non-text content.
-
Time-Based Media
- Provide alternatives for time-based media, such as audio and video.
- Include captions for videos and transcripts for audio content.
- Offer sign language interpretation if possible.
-
Adaptable Content
- Create content that can be presented in different ways without losing information or structure.
- Use semantic HTML to ensure content is adaptable.
- Avoid using tables for layout purposes.
-
Distinguishable Content
- Make it easier for users to see and hear content, including separating foreground from background.
- Ensure sufficient color contrast between text and background.
- Allow users to resize text without loss of content or functionality.
Practical Examples
Example 1: Providing Text Alternatives
Explanation:
- The
alt
attribute provides a text alternative for the image, which is read by screen readers. This is crucial for users who cannot see the image.
Example 2: Captions for Videos
<video controls> <source src="video.mp4" type="video/mp4"> <track kind="captions" src="captions.vtt" srclang="en" label="English"> Your browser does not support the video tag. </video>
Explanation:
- The
<track>
element is used to specify text tracks for<video>
. Here, it provides captions, which are essential for users who are deaf or hard of hearing.
Exercises
Exercise 1: Adding Alt Text
Task: Add appropriate alt
text to the following image tag.
Solution:
Feedback:
- Ensure the
alt
text is descriptive enough to convey the same information as the image.
Exercise 2: Ensuring Color Contrast
Task: Check the color contrast of the following CSS and suggest improvements if necessary.
Solution:
- The contrast ratio between
#ffffff
(white) and#cccccc
(light gray) is too low. Consider using a darker text color.
Feedback:
- Use tools like the WebAIM Color Contrast Checker to ensure your color choices meet accessibility standards.
Conclusion
In this section, we covered the importance of making content perceivable by providing text alternatives, ensuring adaptable content, and maintaining distinguishable content through proper color contrast and text resizing. These practices are essential for creating an inclusive web experience for all users. In the next section, we will explore how to make user interfaces and navigation operable for everyone.
Web Accessibility Course
Module 1: Introduction to Web Accessibility
- What is Web Accessibility?
- Importance of Web Accessibility
- Overview of Accessibility Laws and Standards
- Introduction to WCAG
Module 2: Understanding Disabilities and Assistive Technologies
Module 3: Principles of Accessible Design
- Perceivable: Making Content Available to the Senses
- Operable: User Interface and Navigation
- Understandable: Information and Operation
- Robust: Compatibility with Current and Future Technologies
Module 4: Implementing Accessibility in HTML and CSS
Module 5: Accessibility in JavaScript and Multimedia
- Creating Accessible JavaScript Widgets
- Keyboard Accessibility
- Accessible Video and Audio Content
- Providing Text Alternatives for Images
Module 6: Testing and Evaluating Accessibility
- Manual Testing Techniques
- Automated Testing Tools
- User Testing with Assistive Technologies
- Interpreting Accessibility Reports