gpt4 book ai didi

html - 在
中使用 <header> 在语义上是正确的吗?

转载 作者:搜寻专家 更新时间:2023-10-31 22:25:54 24 4
gpt4 key购买 nike

我在网上找到的所有例子都是指使用<h1>里面<section> , 但与 <header> 的使用无关元素。

它是有效的 HTML5,但是语义呢?

也许我滥用了 <section>元素,为了完整起见,这里是我的用例:

<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>

最佳答案

是的,在 section 中使用 header 在语义上是正确的

header – There is a crucial difference between the header element andthe general accepted usage of header (or masthead). There’s usuallyonly one header or ‘masthead’ in a page. In HTML5 you can have as manyas you want. The spec defines it as “a group of introductory ornavigational aids”. You can use a header in any section on your site.In fact, you probably should use a header within most of yoursections. The spec describes the section element as “a thematicgrouping of content, typically with a heading.”

Source

您还可以检查 header W3 规范 here

关于html - 在 <section> 中使用 &lt;header&gt; 在语义上是正确的吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37121520/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com