Html 正文前的 HTML5 标题?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9083816/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-28 22:11:24  来源:igfitidea点击:

HTML5 header before body?

html

提问by maiwald

I have been using HTML4 for quite some time. I've heard of HTML5 for quite a while but never got around to reading the updated standard and it's new tags. What I would like to know is if I put the header tag before the body tag (and after the head tag), will this be valid? I know that in HTML4 you required to use divs (for instance header and container) to separate the sections of the page.

我使用 HTML4 已经有一段时间了。我听说 HTML5 已经有一段时间了,但从来没有时间阅读更新的标准和它的新标签。我想知道的是,如果我将 header 标签放在 body 标签之前(以及 head 标签之后),这是否有效?我知道在 HTML4 中您需要使用 div(例如标题和容器)来分隔页面的各个部分。

Thanks!

谢谢!

回答by maiwald

No. <header>-tags mark the header of arbitrary sections on your site. Don't confuse them with the website's <head>section that contains scripts, meta-tags, etc. <header>-tags belong into the <body>-tag. The basic structure of a <head>followed by a <body>has not changed in HTML5.

不。<header>-tags 标记您网站上任意部分的标题。不要将它们与<head>包含脚本、元标签等的网站部分混淆。<header>-tags 属于<body>-tag。<head>后跟 a的基本结构<body>在 HTML5 中没有改变。

http://www.w3.org/html/wg/drafts/html/master/sections.html#the-header-element

http://www.w3.org/html/wg/drafts/html/master/sections.html#the-header-element