Advertisement

HTML <head> tag

Examples

A simple HTML document with the most basic essential elements:

<html>

<head>
  <title>文档的标题</title>
</head>

<body>
  文档的内容... ...
</body>

</html>

Try it yourself

Browser Support

IE Firefox Chrome Safari Opera

All browsers support the <head> tag.

Definition and Usage

<Head> tag is used to define the document head, which is a container for all the head elements. <Head> element can be referenced in scripts, instruct the browser where to find style sheets, provide meta information, and more.

The head of the document describes various attributes of information and documents, including the title of the document, the relationship between the position in the Web as well as other documents and the like. Head of the document contains the vast majority of the data are not really as the content is displayed to the reader.

The following tabs are available in the head section: <Base> , <Link> , <Meta> , <Script> , <style> , and <title> .

Title <title> Defines the document, which is the only required part of the head element.

Tips and Notes

Tip: should the <head> tag at the beginning of the document, just after the <html> behind, and is before <body> tag or <frameset> tag.

Tip: Remember to always document specifies the title!

Differences between HTML and XHTML

NONE

Optional attributes

Attributes value description
profile URL A space-separated list of URL, the URL contains metadata information about the page.

For more information about profile properties

The head of the document often contain some <meta> tag to tell the browser to additional information about the document. In the future, the creators may use predefined standard document metadata profile (metadata profile), in order to better describe their documentation. profile property provides a URL and the current profile of the associated document.

Formats and browser configuration file used the way they are still not defined, the property primarily for the development of future reserved placeholder.

Global Properties

<head> tag supports HTML in the global properties .

Examples TIY

The title of the document
Head element inside the header information is not displayed in the browser window.
A target, all the links
This example shows how to use the base tag to make all labels page open in a new window.
HTML in style
This example demonstrates how to use the information to add to the style <head> section of the HTML format.
Link to an external stylesheet
This example demonstrates how <link> tag to link to an external stylesheet.
Document Description
Meta elements of information may describe an HTML document.
Document Keywords
Meta elements of information may describe a document keyword.
Redirection
This example demonstrates: in the case of the URL has changed, users will be redirected to another address.