1. Add alternative text to your logo This has two advantages: the screen reader can identify the meaning of the logo image, and when the image is not loaded, it can also tell non-visually impaired users where your logo is. Copy code The code is as follows: <img src="logo.png" alt="Front-end"> Alternatively, if you use a background image to implement the logo, you can also add a title attribute to achieve it: Copy code The code is as follows: <span title="Front-end world"></span> </code> Of course, the link + background image method is the best, but it is also better to add a title attribute: Copy code The code is as follows: <a title="Front-end world">Front-end world</a> 2. Add basic landmarks ARIA Landmark is a set of website usability rules defined by W3C. Adding descriptive landmarks, or simply called roles, to different modules of a website will help screen readers better understand your web pages, allowing visually impaired users to better use your website. Copy code The code is as follows: <nav role="navigation"> <div id="maincontent" role="main"> <form action="search.php" role="search"> Wait, for specific rules, please check W3C's recommendations. 3. Enhance focus definition In fact, many websites will try their best to remove the browser's :focus style, especially for IE browser. In fact, it makes sense that the browser has the :focus style by default, which can indicate to the user where the current mouse focus is. This is especially important for keyboard flow. Copy code The code is as follows: a:focus{ outline:1px solid red; background:yellow; } If your product manager or visual designer insists on removing the focus state, just take away their mouse for a day and tell them to only use Tab to switch links. 4. Define required form items The aria-required attribute can be used to define required fields in a form - well, it mainly tells screen readers: Copy code The code is as follows: <input type="text" name="username" aria-required="true">
Usually many people are accustomed to using td tags for all tables. In fact, tables have more than just hd tags, there are also th, col, scope, etc. Copy code The code is as follows:<th scope="col">Date</th>
Copy code The code is as follows: <table> <caption>Class Schedule</caption> <tr> … Although such link descriptions do not matter to ordinary people, they are quite bad for screen reading software, and they are actually a kind of interference to visually impaired users. In the past, many people used tabindex to "enhance" the user experience, but this attribute would disrupt the normal reading order of the page, which is disastrous for visually impaired users and may not be friendly to ordinary users. |
<<: Examples of implementing progress bars and order progress bars using CSS
>>: HTML Basics Must-Read - Comprehensive Understanding of CSS Style Sheets
This article uses an example to describe how to i...
This article shares with you the graphic tutorial...
In the past few years, DIV+CSS was very popular in...
Table of contents 1. Install dependencies 2. Conf...
If you’re new to Docker, take a look at some of t...
Idea: Just sort randomly first and then group. 1....
This article example shares the specific code of ...
In the latest HTML standard, there is a calc CSS e...
The css animation of the rotating flip effect, th...
Table of contents 1. Problem description: 2. Trou...
CSS controls the printing style of web pages : Use...
Table of contents environment: 1. Docker enables ...
introduction Sometimes, if there are a large numb...
Preface: MySQL master-slave architecture should b...
js array is probably familiar to everyone, becaus...