main
标签规定文档的主要内容。main
元素中的内容对于文档来说应当是唯一的。它不应包含在文档中重复出现的内容,比如侧栏、导航栏、版权信息、站点标志或搜索表单。注释:在一个文档中,不能出现一个以上的 main
元素。main
元素不能是以下元素的后代:article
、aside
、footer
、header
或 nav
。
<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8" /><title>Using main</title></head><body><header>My page</header><nav>[url=#]Home[/url]</nav><main><article><h1>My article</h1>Content</article><aside>More information</aside></main><footer>Copyright 2013</footer></body></html>
另一个例子:
<main> <h1>Skateboards</h1> The skateboard is the way cool kids get around <article> <h2>Longboards</h2> Longboards are a type of skateboard with a longer wheelbase and larger, softer wheels. ... ... </article> <article> <h2>Electric Skateboards</h2> These no longer require the PRopelling of the skateboard by means of the feet; rather an electric motor propels the board, fed by an electric battery. ... ... </article> </main> <!-- other content -->
HTML 5中又新增加main标签
the main element
新闻热点
疑难解答