HTML5 main element versus ARIA landmark role=“main”

时光毁灭记忆、已成空白 提交于 2019-11-29 01:10:43

According to HTML5 Doctor they are equivalent. <main> just makes it easier and neater to implement role="main".

The primary purpose of is to map ARIA’s landmark role main to an element in HTML.

Here is a general description of the <main> element.

The main element represents the main content of the body of a document or application. The main content area consists of content that is directly related to or expands upon the central topic of a document or central functionality of an application.

Recommendation

It is recommended to use use both <main> and role="main" in the same element until browsers implement <main> properly.

<!-- Recommended -->
<main role="main">
    ...
</main>

Be sure to read the <main> spec if you're interested.

Note on sectioning

As Szabolcs points out in the comments, <main> is not a sectioning element so it should be used in conjunction with a <section> element.

References

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