bootstrap 中關於 HTML5 aria-* and role的用法__HTML

來源:互聯網
上載者:User
HTML5 aria-* and role

在bootstrap中看到role和aria-*,不知道幹嘛的。google一下,發現aria的意思是Accessible Rich Internet Application。 Accessible一般是為不方便的人士提供的功能,比如windows的放大鏡,語音朗讀,高對比主題等。

 

HTML5針對html tag增加的屬性:role 和 aria-*。

 

role的作用是描述一個非標準的tag的實際作用。比如用div做button,那麼設定div 的 role=“button”,協助工具輔助就可以認出這實際上是個button。

ARIA Roles

    Use the ARIA role attribute to indicate that a generic tag is playing the role of a standard widget like a button.

 

而aria-*的作用就是描述這個tag在可視化的情境中的具體資訊。比如,

<div role="checkbox" aria-checked="checked"></div>

協助工具輔助就會知道,這個div實際上是個checkbox的角色,為選中狀態。

Add ARIA for screen readers

    ARIA attributes provides semantic information to screen readers that is normally conveyed visually.

    Note that using ARIA does not automatically implement the standard widget behavior, you'll still need to add focus management and keyboard navigation yourself.

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.