HTML
<head>
element
contains machine-readable information (
metadata
) about the document, like its
title
,
脚本
,和
样式表
.
注意:
<head>
primarily holds information for machine processing, not human-readability. For human-visible information, like top-level headings and listed authors, see the
<header>
元素。
| 内容类别 | None. |
|---|---|
| 准许内容 |
If the document is an
<iframe>
srcdoc
document, or if title information is available from a higher level protocol (like the subject line in HTML email), zero or more elements of metadata content.
Otherwise, one or more elements of metadata content where exactly one is a
|
| Tag omission |
The start tag may be omitted if the first thing inside the
<head>
element is an element.
The end tag may be omitted if the first thing following the
<head>
element is not a space character or a comment.
|
| Permitted parents |
An
<html>
element, as its first child.
|
| Implicit ARIA role | 无对应角色 |
| Permitted ARIA roles |
No
role
permitted
|
| DOM 接口 |
HTMLHeadElement
|
此元素包括 全局属性 .
profile
<!doctype html>
<html>
<head>
<title>Document title</title>
</head>
</html>
HTML5-compliant browsers automatically create a
<head>
element if its tags are omitted in the markup.
This auto-creation is not guaranteed in ancient browsers
.
| 规范 | 状态 | 注释 |
|---|---|---|
|
HTML 实时标准
The definition of '<head>' in that specification. |
实时标准 | No change from latest shapshot |
|
HTML5
The definition of '<head>' in that specification. |
推荐 |
Obsoleted
profile
|
|
HTML 4.01 Specification
The definition of '<head>' in that specification. |
推荐 |
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
更新 GitHub 上的兼容性数据| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | Android webview | Chrome for Android | Firefox for Android | Opera for Android | Safari on iOS | Samsung Internet | |
head
|
Chrome 完整支持 1 | Edge 完整支持 12 | Firefox 完整支持 1 | IE 完整支持 Yes | Opera 完整支持 Yes | Safari 完整支持 Yes | WebView Android 完整支持 Yes | Chrome Android 完整支持 Yes | Firefox Android 完整支持 4 | Opera Android 完整支持 Yes | Safari iOS 完整支持 Yes | Samsung Internet Android 完整支持 Yes |
profile
弃用
非标
|
Chrome 完整支持 1 | Edge 完整支持 12 | Firefox 完整支持 1 | IE 完整支持 Yes | Opera 完整支持 Yes | Safari 完整支持 Yes | WebView Android 完整支持 Yes | Chrome Android 完整支持 Yes | Firefox Android 完整支持 4 | Opera Android 完整支持 Yes | Safari iOS 完整支持 Yes | Samsung Internet Android 完整支持 Yes |
完整支持
非标。预期跨浏览器支持较差。
弃用。不要用于新网站。
<head>
: