在HTML5中,< header>和< footer>标签出现在< body>外部标签? [英] In HTML5, can the <header> and <footer> tags appear outside of the <body> tag?

查看:127
本文介绍了在HTML5中,< header>和< footer>标签出现在< body>外部标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在正在以这种方式使用上述代码(经典标记顺序):

 < 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> 标签。因为只是一个布局组件,所以在中包含所有元数据和内容。

并且布局进入 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中,&lt; header&gt;和&lt; footer&gt;标签出现在&lt; body&gt;外部标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆