HTML <head>
HTML <head> element
The <head> element contains all the head tag elements. In the <head> element you can insert scripts, style files (CSS), and various meta information.
The element tags that can be added in the header area are: <title>, <style>, <meta>, <link>, <script>, <noscript>, and <base>.
HTML <title> element
The <title> tag defines the title of different documents.
<title> is required in HTML / XHTML documents.
<title> element:
- Defines the title of the browser toolbar
- When a webpage is added to a favorite, the title displayed in the favorite
- The title displayed on the search engine results page
A simple HTML document:
Examples
HTML <base> element
The <base> tag describes the basic link address / link target. This tag serves as the default link for all link tags in HTML documents:
<head> <base href="http://www.runoob.com/images/" target="_blank"> </head>
HTML <link> element
The <link> tag defines the relationship between the document and external resources.
The <link> tag is usually used to link to a style sheet:
<head> <link rel="stylesheet" type="text/css" href="mystyle.css"> </head>
HTML <style> element
The <style> tag defines the reference address of the style file of the HTML document.
You can also add styles directly in the <style> element to render HTML documents:
<head> <style type="text/css"> body {background-color:yellow} p {color:blue} </style> </head>
HTML <meta> element
The meta tag describes some basic metadata.
The <meta> tag provides metadata. The metadata is not displayed on the page, but will be parsed by the browser.
The META element is usually used to specify the description of the web page, keywords, the last modification time of the file, author, and other metadata.
Metadata can be used in browsers (how to display content or reload pages), search engines (keywords), or other web services.
<meta> is generally placed in the <head> area
<meta> tag-use case
Define keywords for search engines:
<meta name="keywords" content="HTML, CSS, XML, XHTML, JavaScript">
Define the description for the web page:
<meta name = "description" content = "Free Web & Programming Tutorial">
Define Web page author:
<meta name="author" content="Runoob">
Refresh the current page every 30 seconds:
<meta http-equiv="refresh" content="30">
HTML <script> element
The <script> tag is used to load script files, such as: JavaScript.
The <script> element will be described in detail in later chapters.
HTML head element
label | description |
---|---|
<head> | Define the information of the document |
<title> | Defines the title of the document |
<base> | Defines the default link address of the page link label |
<link> | Defines the relationship between a document and external resources |
<meta> | Defines metadata in HTML documents |
<script> | The script file of the client is defined |
<style> | Defines the style file of the HTML document |