使用< header>在语义上是正确的。里面< section>? [英] It is semantically correct to use <header> inside <section>?
问题描述
我在互联网上找到的所有示例都指的是在< section>
中使用< h1>
,但没有与使用< header>
元素有关。
All examples I found on internet refers to using <h1>
inside <section>
, but nothing related to the use of <header>
element.
这是有效的HTML5,但是语义呢?
It's valid HTML5, but what about semantics?
也许我在滥用< section>
元素,这里的完整性是我的用例:
Maybe I'm misusing the <section>
element, for the completeness here is my use case:
<main role="main">
<header>page header</header>
<section id="cookiesPolicy>
<header>
<h1>Cookies Policiy</h1>
</header>
<div>Bla bla bla bla bla bla bla</div>
</section>
<footer>page footer</footer>
</main>
推荐答案
是否在语义上正确使用标题
在区内
Yes it is semantically correct to use header
inside section
标题 -
标题
元素与
标题$>的一般接受用法之间存在重要差异c $ c>(或标头)。页面中通常只有
只有一个标题
或'标头'。在HTML5中你可以有多少
如您所愿。规范将其定义为一组介绍性或
导航辅助工具。您可以在任何部分使用
在您的网站上。标头
事实上,您可能应该这样做在大多数
部分中使用标题
。该规范将部分
元素描述为主题
内容分组,通常带有标题。
header – There is a crucial difference between the
header
element and the general accepted usage ofheader
(or masthead). There’s usually only oneheader
or ‘masthead’ in a page. In HTML5 you can have as many as you want. The spec defines it as "a group of introductory or navigational aids". You can use aheader
in anysection
on your site. In fact, you probably should use aheader
within most of your sections. The spec describes thesection
element as "a thematic grouping of content, typically with a heading."
您还可以查看标题
W3规范此处
You can also check header
W3 specs here
这篇关于使用< header>在语义上是正确的。里面< section>?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!