码迷,mamicode.com
首页 > 数据库 > 详细

[HTML5] Semantics for accessibility

时间:2018-03-11 11:57:19      阅读:177      评论:0      收藏:0      [点我收藏+]

标签:ssi   inline   ike   sem   box   for   htm   off   letter   

For example, when we use checkbox, if we do like this:

              <div class="inline-control sign-up col-1">
                <input type="checkbox" checked name="jLetter" id="jLetter"> Receive promotional offers?
              </div>

When we use screen reader, it will lose the semantics meaning, it only say:

checkbox checked

Instead, we want to hear:

Receive promotional offers?, checkbox, checked

 

There are two way to do it:

1. label wrap the checkbox

              <div class="inline-control sign-up col-1">
                <label>
                  <input type="checkbox" checked name="jLetter"> Receive promotional offers?
                </label>
              </div>

2. Using id to match label and checkbox

              <div class="inline-control sign-up col-1">
                <div class="promotional">
                  <input type="checkbox" checked name="jLetter" id="jLetter">
                  <label for="jLetter">Receive promotional offers?</label>
                </div>
              </div>

 

[HTML5] Semantics for accessibility

标签:ssi   inline   ike   sem   box   for   htm   off   letter   

原文地址:https://www.cnblogs.com/Answer1215/p/8542988.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!