DAD*_*ADU 2 article html5 semantics
语义:你想让他们正确,但有时他们只是混乱.
网站文件结构:
<body>
<header>
<div id="main">
<header> (not on every page)
<div id="content">
<footer> (not on every page)
<aside>
<footer>
Run Code Online (Sandbox Code Playgroud)
用文章标签替换div#main在语义上是否正确?
为了解决这个问题的死亡人数,目前接受的答案很快就会出错.有一个<main>针对您需要的元素的扩展草案.此外,它还可以role="main"在浏览器中自动化ARIA ,以实现更好的可访问性.有关详细信息,请参阅此链接:https://dvcs.w3.org/hg/html-extensions/raw-file/tip/maincontent/index.html
此规范是HTML5规范[HTML5]的扩展.它定义了用于标识文档主要内容区域的元素.除非本规范明确覆盖,否则HTML5规范中的所有规范性内容均旨在成为本规范的基础.
主要元素使用诸如"content"和"main"之类的id值来规范识别文档主要内容部分的通用实践.它还定义了一个HTML元素,它体现了WAI-ARIA [ARIA] landmark role = main的语义和功能.
<main>
<h1>Apples</h1>
<p>The apple is the pomaceous fruit of the apple tree.</p>
<article>
<h2>Red Delicious</h2>
<p>These bright red apples are the most common found in many
supermarkets.</p>
<p>... </p>
<p>... </p>
</article>
<article>
<h2>Granny Smith</h2>
<p>These juicy, green apples make a great filling for
apple pies.</p>
<p>... </p>
<p>... </p>
</article>
</main>
Run Code Online (Sandbox Code Playgroud)