HTML5 role attribute for tags

一笑奈何 提交于 2019-12-20 07:58:30

问题


My HTML5 template has h1 elements on every page (that I use for keyword) on top left part of the page.

Is there a role attribute to sign them as tags like the tags in WorPress?


回答1:


As defined by W3C, you can use this values for role attribute:

  • banner
  • complementary
  • contentinfo
  • definition
  • main
  • navigation
  • note
  • search

contentinfo purpose is to provide meta information about the content, so it could be used for tag management. That said, <h1> shouldn't be used as tags, as it's main purpose is to explicitly describe the whole page

Source




回答2:


You can find a list of all WAI-ARIA roles in the WAI-ARIA 1.0 specification:
http://www.w3.org/TR/2014/REC-wai-aria-20140320/roles#role_definitions

There doesn’t seem to be a role for tags. The contentinfo role could be used for the element that contains all tags the current document is tagged with.

In HTML5, contentinfo is the default role for the footer element, which is the element you should use for tags anyhow (instead of h1, which would typically be not correct). You might be interested in my related answer about semantic markup for tags.



来源:https://stackoverflow.com/questions/26545030/html5-role-attribute-for-tags

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!