HTML header


May 02, 2021 11:07 HTML


Table of contents


HTML <head>

HTML header elements contain a profile of the document, also known as meta-information.


HTML header

View online instances

The title of the HTML document is defined
Define the title of the HTML document using the hashtag

The URL of all links is defined
Define the default link destination address for all links on the page, using slt;base.

The meta tag of the HTML document is provided
Use the elements to describe the description, keywords, authors, character sets, etc. of the HTML document.


HTML and head elements

The element contains all the head label elements. You can insert scripts, style files (CSS), and various meta-information in the element.

Elements that can be added to the head area can be labeled as: slt;title>, slt;style>, slt;meta-gt;, slt;script>, slt;noscript> and slt;base>.

The element describes the various properties and information of the document, including the title of the document, its location on the Web, and its relationship to other documents.


HTML and lt;title

The label defines the titles of different documents.

Title is required in HTML/XHTML documents.

Title element:

  • The title of the browser toolbar is defined
  • When a page is added to a favorite, the title appears in the favorite
  • The title that appears on the search engine results page

A simple HTML document:

<!DOCTYPE html>

<html>

<head>

<title>编程狮(w3cschool.cn)</title>

</head>

<body>

w3cschool随时随地学编程!

</body>

</html>


Try it out . . .

HTML

The label describes the basic link address/link destination, which as all links in the HTML document specifies the default address or target:

<head>

<base href="//www.w3cschool.cn/images/" target="_blank">

</head>

Tip: In HTML, the label does not end the label, and in XHTML, the label must be turned off correctly.


HTML

The label defines the relationship between the document and external resources.

Labels are typically used to link to style sheets:

<head>

<link rel="stylesheet" type="text/css" href="mystyle.css">

</head>


HTML

The label defines the style file reference address of the HTML document.

In the element, you need to specify a style file to render the HTML document:

<head>

<style type="text/css">

body {background-color:yellow}

p {color:blue}

</style>

</head>


Try it out . . .


HTML and meta-elements

Metadata is information about data.

The label provides metadata about the HTML document. Metadata is not displayed on the page, but is readable for the machine.

Typically, the meta element is used to specify the description of the page, keywords, author of the document, last modified time, and other metadata.

The label is always in the head element.

Metadata can be used for browsers (how to display content or reload pages), search engines (keywords), or other Web services.

Keywords for search engines

Some search engines use the name and content properties of meta elements to index your pages.

The following meta element defines the description of the page:

<meta name="description" content="Free Web tutorials on HTML, CSS, XML" />

The following meta element defines the key words of the page:

<meta name="keywords" content="HTML, CSS, XML" />

The name and content properties are used to describe the content of the page.


HTML . . .

The label is used to load script files such as JavaScript.

The elements are described in more detail in the following sections.


HTML head element

Label Describe
<head> The information for the document is defined
<title> The title of the document is defined
<base> The default link address for the page link label is defined
<link> Defines the relationship between a document and an external resource
<meta> Metadata in HTML documents is defined
<script> The script file for the client is defined
<style> A style file that defines an HTML document