最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Bootstrap的aria-label和aria-labelledby屬性實(shí)例詳解

 更新時(shí)間:2018年11月02日 10:21:35   作者:Mr.zengcx  
這篇文章主要介紹了Bootstrap的aria-label和aria-labelledby屬性實(shí)例詳解,需要的朋友可以參考下

aria-label

正常情況下,form表單的input組件都有對(duì)應(yīng)的label.當(dāng)input組件獲取到焦點(diǎn)時(shí),屏幕閱讀器會(huì)讀出相應(yīng)的label里的文本。

<!DOCTYPE html>
<html>
<head>
  <meta charset = "utf-8">
  <title>demo</title>
  <link rel="stylesheet"  rel="external nofollow" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
  <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
 <script src="https://cdn.bootcss.com/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
 <script src="https://cdn.bootcss.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
  <style type="text/css">
    body{padding: 20px;}
  </style>
</head>
<body>
  <form role = "form">
    <div class="form-group col-lg-3 form-horizontal">
      <label for = "idCard" class="control-label col-lg-5">身份證號(hào):</label>
      <div class="col-lg-7">
        <input type = "text" id = "idCard" class="form-control">
      </div>    
    </div>  
  </form>
</body>
</html>

但是如果我們沒(méi)有給輸入框設(shè)置label時(shí),當(dāng)其獲得焦點(diǎn)時(shí),屏幕閱讀器會(huì)讀出aria-label屬性的值,aria-label不會(huì)在視覺(jué)上呈現(xiàn)效果。

<body>
  <form role = "form">
    <div class="form-group col-lg-3 form-horizontal">
      <div class="col-lg-7">
        <input type = "text" id = "idCard" class="form-control" aria-label = "身份證號(hào)">
      </div>    
    </div>  
  </form>
</body>

aria-labelledby
<body>
  <div class="dropdown">
    <button type="button" class="btn dropdown-toggle" id="dropdownMenu1" 
     data-toggle="dropdown">
     選擇您的職位
     <span class="caret"></span>
    </button>
    <ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1">
     <li role="presentation">
       <a role="menuitem" tabindex="-1" href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" >測(cè)試工程師</a>
     </li>
     <li role="presentation">
       <a role="menuitem" tabindex="-1" href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" >開(kāi)發(fā)工程師</a>
     </li>
     <li role="presentation">
       <a role="menuitem" tabindex="-1" href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" >銷售工程師</a>
     </li>     
    </ul>
  </div>
</body>

注:

如果一個(gè)元素同時(shí)有aria-labelledby和aria-label,讀屏軟件會(huì)優(yōu)先讀出aria-labelledby的內(nèi)容

總結(jié)

以上所述是小編給大家介紹的Bootstrap的aria-label和aria-labelledby屬性實(shí)例詳解,希望對(duì)大家有所幫助,如果大家有任何疑問(wèn)請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!

相關(guān)文章

最新評(píng)論

桦川县| 西宁市| 汉沽区| 广灵县| 循化| 德州市| 潜江市| 盐池县| 太保市| 泗水县| 分宜县| 友谊县| 垣曲县| 荔浦县| 洛扎县| 双桥区| 休宁县| 犍为县| 拉萨市| 洮南市| 阿拉善左旗| 四会市| 拉萨市| 塔河县| 扶绥县| 台中市| 准格尔旗| 平阴县| 怀柔区| 保靖县| 商丘市| 黄石市| 花莲市| 留坝县| 汽车| 辽宁省| 河源市| 哈尔滨市| 英超| 鸡泽县| 崇阳县|