问题
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