HTML role attribute
What is the HTML attribute role
used for? Who is it specified for? Is it mandatory for HTML elements?
P. S. The question "id, class, and role to the element " only answers a third of my question.
10
Author: Дух сообщества, 2017-01-25
2 answers
This attribute is used for semantic tags, of which there are a large number in HTML5.
The role
attribute allows you to most clearly specify the purpose of the page block/element when the user interacts with the site.
This attribute is optional and mostly formal.
The main and most commonly used role values are:
-
banner
- contains the main header or the internal one page title. For example, the logo and the name of the site. It is recommended to use it no more than once per page. -
complementary
- an information block separated from the main content of the resource. -
contentinfo
- summary information about the page content ( for example, the site footer). It is recommended to use it no more than once per page. -
definition
- specifies the definition of the term or concept. -
main
- serves as the main content of the document. It is recommended to use it no more than once per page. -
navigation
- a set of elements intended for navigation through a document or related documents. It is recommended to use it no more than once per page. -
note
- a note (auxiliary information) to the main content of the resource. -
search
- specifies the area to search by content.
12
Author: ragmon, 2017-01-25 17:35:52