WAI-ARIA无障碍网页应用属性(html-role)
详细:https://www.w3.org/TR/html-aria/#docconformance
html元素的role怎么写?重新整理,个人学习使用。
常用的标签元素对应的 ARIA 的 role,仅供参考:
| HTML元素 | ARIA (role =) | 备注 |
|---|---|---|
| a with href | role=link |
|
| a / li / p / div | menuitem |
父元素下的一个菜单项,不限于 |
| article | article | |
| aside | complementary | |
| body | document | |
| button | button | |
| dd | definition | |
| dialog | dialog | |
| footer | contentinfo | |
| form | form | |
| h1~h6 | heading |
对应是使用 |
| header | banner | |
| hr | separator | |
| img | img | |
| input | button |
input的 |
| input | button |
input的 |
| input | checkbox |
input的 |
| input | menuitemcheckbox |
input的 |
| input | textbox |
input的 |
| input | spinbutton |
input的 |
| input | slider |
input的 |
| input | combobox |
input的 |
| li | listitem |
父元素是ol或ul或menu |
| main | main | |
| nav | navigation | |
| ol或ul | list | |
| optgroup | group | |
| option | option | aria-selected的默认值为true |
| progress | progressbar |
|
| section | region | |
| table | table | |
| tbody | rowgroup |
|
| td | cell |
祖先元素具有 |
| th | columnheader |
表格的列标题,表格的横标题对应的 |
| tr | row |
--------------本文结束 感谢您的阅读--------------