我是新的 HTML5 标记。
我想知道是否允许在节标签中有一个页眉和页脚标签,如下所示:
<section>
<header>
<h2>HEADER</h2>
</header>
<p>Section's Content</p>
<footer>
<h2>FOOTER</h2>
</footer>
</section>
或者最好用 div 标签替换它们并为它们设置类。
提前谢谢你。
根据 MDN,你可以使用它。
Header tag允许的父级:Any element that accepts flow content
。请注意,元素不能是<address>, <footer>
或其他<header>
元素的后代。
Footer tag允许的父级:Any element that accepts flow content
。请注意,元素不能是<address>, <header>
或其他<footer>
元素的后代。
section
是flow content element。您可以在其中包含页眉和页脚标记。
最好的做法是做类似的事情(您也可以将section
替换为div
,如果您愿意)
<header>
<h2>HEADER</h2>
</header>
<section>
<p>Section's Content</p>
</section>
<footer>
<h2>FOOTER</h2>
</footer>
您可以根据需要拥有尽可能多的标题标签,并将它们放置在几乎任何其他元素中,但有一些例外:
Headers://www.w3schools/tags/tag_header.asp
注意:<header>
标记不能放在<footer>
、<address>
或其他<header>
元素中。
s://www.w3schools/tags/tag_footer.asp
<footer>
标签定义文档或节的页脚。
所以<header>
和<footer>
在部分内很好,相应的 w3c 链接甚至明确表示它们可以在部分内使用。
本站系公益性非盈利分享网址,本文来自用户投稿,不代表边看边学立场,如若转载,请注明出处
评论列表(1条)