html5 header content usually includes: 1. Web page title defined by title tag; 2. Favicon (small website icon); 3. Encoding method; 4. Website description; 5. Page keywords; 6. Page Author; 7. Viewport (mobile terminal adaptation); 8. CSS style sheet; 9. JavaScript script.
The operating environment of this tutorial: Windows 7 system, HTML5 version, Dell G3 computer.
According to our needs, we can define a large amount of metadata in the HTML header, or we can define little or no metadata at all. Although the head tag is part of the HTML document, its content is not displayed in the browser.
html5 header content
1. Web page title--
<head> <title>PHP中文网</title> </head>
2, Favicon
The small icon to the left of the web page title, specify If his path is not specified, the browser will look for<link rel="icon" href="/favicon.ico" type="image/x-icon" />
3 in the root directory. Encoding method
The specification of the encoding method is placed at the front of the head. , if not specified, the browser will also make a determination based on the server's header, but it may not be accurate.<head> <meta charset="UTF-8"> </head>
tag is used to provide metadata about the HTML document, such as page validity period, page author, keyword list, page description, etc. The data defined by the tag will not be displayed on the page, but will be parsed by the browser.The charset attribute is used to specify the character encoding of the HTML document. In the above example, we set the character encoding of the document to "UTF-8".
4. Website description
<meta name="description" content="这里是对网站的描述">
5, PageKeywords
<meta name="keywords" content="HTML, HTML教程, HTML入门">
6, Page author
<meta name="author" content="作者名">
7. Viewport (mobile terminal adaptation)
This is very common. Viewport is usually adapted to the mobile terminal, and the page Put it in a virtual window - viewport. If the web page does not use the viewport, it will appear when we open the mobile browser. It is very small, and it can also be moved and zoomed. It is extremely low. The viewport allows web developers to pass its size and dynamics. Set the size of the control elements in the web page content, so that the same effect (scale reduction) as in the web page can be achieved on the browser. , used to better support responsive websites.<meta name="viewport" content="width=device-width, initial-scale=1">
8. Embedded CSS style--