Html HTML5/XHTML 角色属性可以具有哪些值?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4170356/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 05:15:27  来源:igfitidea点击:

What values can the HTML5/XHTML role attribute have?

html

提问by HELP

I was wondering what values are valid in the HTML5/XHTML role attribute?

我想知道 HTML5/XHTML 角色属性中哪些值是有效的?

回答by Zim

Here are the valid roles based on HTML 5.2...

以下是基于 HTML 5.2 的有效角色...

  • alert
  • alertdialog
  • application
  • article
  • banner
  • button
  • cell
  • checkbox
  • columnheader
  • combobox
  • complementary
  • contentinfo
  • definition
  • dialog
  • directory
  • document
  • feed
  • figure
  • form
  • grid
  • gridcell
  • group
  • heading
  • img
  • link
  • list
  • listbox
  • listitem
  • log
  • main
  • marquee
  • math
  • menu
  • menubar
  • menuitem
  • menuitemcheckbox
  • menuitemradio
  • navigation
  • none
  • note
  • option
  • presentation
  • progressbar
  • radio
  • radiogroup
  • region
  • row
  • rowgroup
  • rowheader
  • scrollbar
  • search
  • searchbox
  • separator
  • slider
  • spinbutton
  • status
  • switch
  • tab
  • table
  • tablist
  • tabpanel
  • term
  • textbox
  • timer
  • toolbar
  • tooltip
  • tree
  • treegrid
  • treeitem
  • 警报
  • 警报对话框
  • 应用
  • 文章
  • 横幅
  • 按钮
  • 细胞
  • 复选框
  • 列标题
  • 组合框
  • 补充
  • 内容信息
  • 定义
  • 对话
  • 目录
  • 文档
  • 喂养
  • 数字
  • 形式
  • 网格
  • 网格单元
  • 团体
  • 标题
  • 图片
  • 关联
  • 列表
  • 列表框
  • 项目清单
  • 日志
  • 主要的
  • 天棚
  • 数学
  • 菜单
  • 菜单栏
  • 菜单项
  • 菜单项复选框
  • 菜单项收音机
  • 导航
  • 没有任何
  • 笔记
  • 选项
  • 介绍
  • 进度条
  • 收音机
  • 无线电组
  • 地区
  • 行组
  • 行头
  • 滚动条
  • 搜索
  • 搜索框
  • 分隔器
  • 滑块
  • 旋转按钮
  • 地位
  • 转变
  • 标签
  • 桌子
  • 表列表
  • 面板
  • 学期
  • 文本框
  • 计时器
  • 工具栏
  • 工具提示
  • 树形网格
  • 树项

回答by RobertB

It appears that in HTML5, the contents of the roleattribute is specified as a WIA-ARIA attribute. See, specifically, the last paragraph of section 3.2.3 "Global attributes", where it states:

似乎在 HTML5 中,该role属性的内容被指定为 WIA-ARIA 属性。具体参见第 3.2.3 节“全局属性”的最后一段,其中指出:

To enable assistive technology products to expose a more fine-grained interface than is otherwise possible with HTML elements and attributes, a set of annotations for assistive technology products can be specified (the ARIA role and aria-* attributes).

为了使辅助技术产品能够公开比 HTML 元素和属性更精细的界面,可以指定一组辅助技术产品的注释(ARIA 角色和 aria-* 属性)。

The roleattribute is, then, further detailed in section 3.2.7 "WAI-ARIA", and provides an apparently normative table of semantics and values for the attribute on an element-by-element basis.

role然后,在第 3.2.7 节“WAI-ARIA”中进一步详细说明了该属性,并在逐个元素的基础上为该属性提供了一个明显规范的语义和值表。

Note: The links to specific sections of the HTML5 specification above point to the "latest published version" of the HTML5 Technical Report at http://www.w3.org/TR/html5/. A more current "editor's draft" version might be available. The TR will link to it on the title page of the document. As the specification is updated or transitions to a new phase of adoption, these links might break and will need to be updated.

注意:上述 HTML5 规范特定部分的链接指向http://www.w3.org/TR/html5/ 上HTML5 技术报告的“最新发布版本” 。可能会提供更新的“编辑草稿”版本。TR 将在文档的标题页上链接到它。随着规范更新或过渡到新的采用阶段,这些链接可能会中断并需要更新。