在HTML5中,< header>和< footer>标签出现在< body>外部标签? [英] In HTML5, can the <header> and <footer> tags appear outside of the <body> tag?
问题描述
我现在正在以这种方式使用上述代码(经典标记顺序):
< html>
< head> ...< / head>
< body>
< header> ...< / header>
< section> ...< / section>
< footer> ...< / footer>
< / body>
< / html>
标签的使用和规格在以前版本的HTML(4.x)中非常严格,而HTML5 doesn '真的需要< head>
甚至< body>
标签。
所以我会使用下面的结构,恕我直言比以前的结构更加语义化。
< HTML>
< header> ...< / header> <! - 将标题和页脚放在身体标记之外 - >
< body>
< section> ...< / section>
< section> ...< / section>
< section> ...< / section>
< / body>
< footer> ...< / footer>
< / html>
您怎么看?
那么,< head>
标记与< header> $ c无关$ c>标签。因为
头
只是一个布局组件,所以在头
中包含所有元数据和内容。
并且布局进入 body
。所以我不同意你。
I'm currently using the above tags in this way (classic tag order):
<html>
<head>...</head>
<body>
<header>...</header>
<section>...</section>
<footer>...</footer>
</body>
</html>
Tag usage and specifications were very rigid in previous versions of HTML (4.x), while HTML5 doesn't really need <head>
and even <body>
tags.
So I would use the following structure, which IMHO is much more semantic than the previous one.
<html>
<header>...</header> <!-- put header and footer outside the body tag -->
<body>
<section>...</section>
<section>...</section>
<section>...</section>
</body>
<footer>...</footer>
</html>
What do you think?
Well, the <head>
tag has nothing to do with the <header>
tag. In the head
comes all the metadata and stuff, since the header
is just a layout component.
And layout comes into body
. So I disagree with you.
这篇关于在HTML5中,< header>和< footer>标签出现在< body>外部标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!