Html <header> 与 <head>
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3434950/
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
<header> vs. <head>
提问by Simplicity
In this tutorial: http://railstutorial.org/chapters/filling-in-the-layout#top
在本教程中:http: //railstutorial.org/chapters/filling-in-the-layout#top
There is "header"
有“头”
I know that in HTML there is "head"
我知道在 HTML 中有“头”
But, what is <header>
?
但是,什么是<header>
?
Thanks.
谢谢。
回答by Rex M
<header>
is one of several new tags in HTML5that are supposed to replace <div>
for some specific situations. In particular, the "header" part of your page - whatever that is, usually the part that would be wrapped in <div class="header">
- in HTML5 you should use <header>
instead.
<header>
是HTML5中应该在<div>
某些特定情况下替换的几个新标签之一。特别是,<div class="header">
您应该改用 HTML5 中页面的“标题”部分 - 无论是什么,通常是将被包裹的部分<header>
。
Chapter 3 of Dive into HTML5by Mark Pilgrimdoes an excellent job going into the details of when and why to use the new <header>
element.
Mark Pilgrim的 Dive into HTML5 第 3 章在详细介绍何时以及为何使用新<header>
元素方面做得非常出色。
回答by Daniel Vandersluis
回答by Palash Debnath
<header>
is from HTML5 and it meant to be contain the top/navigational part of your webpage in <body>
. Like top logo, menu, slogan and other heading stuff.
<header>
来自 HTML5,它意味着包含网页的顶部/导航部分<body>
。像顶部标志,菜单,口号和其他标题的东西。
回答by Ganeshgm7
<head>
Defines the information about the article such as including meta data,title,links & scripts. It doesn't have a visual appearance.
<head>
定义有关文章的信息,例如包括元数据、标题、链接和脚本。它没有视觉外观。
<header>
is defines a header for a document or a section. It is added in HTML5. It have a visual appearance, it will be useful to show header logo, menu & other heading details. It needs to define inside the body.
<header>
is 定义文档或部分的标题。它是在 HTML5 中添加的。它具有视觉外观,显示标题徽标、菜单和其他标题详细信息将很有用。它需要在体内定义。
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Ganesamoorthi M</title>
<meta name="author" content="Ganesamoorthi M">
<meta name="description" content="Head vs Header">
<meta name="keywords" content="HTML,CSS,Head,Header">
</head>
<body>
<header>
<h1>Ganesamoorthi M - Software Developer</h1>
</header>
<section>
<p>Head vs Header</p>
</section>
<footer>
<p>© 2018 Ganesamoorthi M</p>
</footer>
</body>
</html>
回答by Hendrik Brummermann
The "header" element does not exist in the current html specification so it is ignored (but may be styled using css of course). It is part of the current draft for the upcoming HTML version 5.
当前 html 规范中不存在“header”元素,因此它被忽略(但当然可以使用 css 设置样式)。它是即将到来的 HTML 版本 5 的当前草案的一部分。
It is not related to the "head" element which contains information page the page but no structure.
它与包含页面信息但没有结构的“head”元素无关。