HTML5主要元素与ARIA界标角色=“主要” [英] HTML5 main element versus ARIA landmark role="main"
问题描述
我有兴趣详细了解HTML5 < main>
元素与ARIA里程碑角色属性<$ c $之间的关系和可能的区别c> role =main。
我的印象是< main> ;
元素是将ARIA卷属性 role =main
映射到特定的HTML元素上。但是这样总结吗?
使用< main>
比使用< div role =main>
?或者将这些,现在和可预见的未来,产生相同的结果?
任何洞察比较下面的例子将不胜感激:
< body>
< main>
< p>段落< / p>
< main>
< / body>
<身体GT;
< main role =main>
< p>段落< / p>
< main>
< / body>
<身体GT;
< div role =main>
< p>段落< / p>
< div>
< / body>
根据HTML5 Doctor的说法,它们是相同的。 < main>
只是让它更容易和更简洁地实现 role =main
。
主要目的是将ARIA的标志性角色主要映射到HTML中的一个元素。
以下是< main>
元素的一般说明。
main
元素表示文档或应用程序的主体
的主要内容。主要内容区域由与文档的核心主题或应用程序的中心功能直接相关或扩展的内容组成。
建议
建议使用< main>
和 role = main
直到浏览器正确地执行< main>
为止。
<! - 推荐 - >
< main role =main>
...
< / main>
请务必阅读 < main>
规范。 / p>
关于切分的注意事项
正如Szabolcs在评论中指出的那样,< main>
不是分区元素,所以它应该与< section>
元素结合使用。
参考文献
I'm interested to learn more about the relationship, and possible distinctions, between the HTML5 <main>
element, and the ARIA landmark role attribute role="main"
.
I'm under the impression that the purpose of the <main>
element is to map the ARIA roll attribute role="main"
onto a specific HTML element. But does that sum it up?
Are there benefits to using <main>
over, say, <div role="main">
? Or will these, for now and the foreseeable future, yield the same result?
Any insights in comparing the following examples would be greatly appreciated:
<body>
<main>
<p>Paragraph</p>
<main>
</body>
<body>
<main role="main">
<p>Paragraph</p>
<main>
</body>
<body>
<div role="main">
<p>Paragraph</p>
<div>
</body>
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 thebody
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
这篇关于HTML5主要元素与ARIA界标角色=“主要”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!