The tag defines the title of the web page and is also a must-have tag. If you do not write it, the web page will automatically add one for you. The title can be seen on a normal web page. The following picture shows the usage code of the head tag in the entire HTML: (detailed explanation will be given later) <!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>PHP中文网</title>
<meta name="keywords" content="PHP,PHP中文网">
<meta name="description" content="网页描述的内容,这有不少字的,在搜索页面呈现的">
<meta http-equiv="refresh" content="5;//m.sbmmt.com">
</head>
<body>
hello world
</body>
</html>
Copy after login
Effect picture:
This is the effect of the title tag, showing the title.
The second one talks about the tag:
This tag has the following four uses:
1. This The tag is displayed in the first line of the head tag. It is used to set the web page document encoding and declare to the current browser what encoding method it is to prevent the browser from garbled characters.
This is how it is used:
<meta charset="utf-8">
Copy after login
This is the specification of html5,
The specification of HTML4.01 is like this:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Copy after login
2.This The tag is used to set keywords for webpages, and is specially designed to provide services for search engines.
Usage is:
<meta name="keywords" content="PHP,PHP中文网">
Copy after login
Explanation: name="keywords" is a fixed way of writing. The keywords are set in the attribute value of the content attribute later, separated by commas.
3.This tag is used to describe the website. If there is a corresponding description written here, the information will be displayed in the introduction of the website by search engines.
The usage of this is:
<meta name="description" content="网页描述的内容,这有不少字的,在搜索页面呈现的">
Copy after login
It’s not easy to display, please show me a picture
The text set there will be Appears as the text in this box in searches.
4. The last tag defines website redirection.
Usage:
<meta http-equiv="refresh" content="5;//m.sbmmt.com">
Copy after login
There are two parameters written in the content attribute, separated by semicolons, which means that it will jump to the target URL page after 5 seconds.
The third one is to talk about the tag in the head tag in HTML: The base tag in the head tag of
defines how the link in the window is opened. , as long as this is set in the header of the web page, then this web page does not need to add this target attribute to the hyperlink.
Indicates that the target addresses of all hyperlinks in the web page are opened in a new window (this attribute will be overridden by the target attribute in each link.)
Introduce to you the two attribute values of the target attribute of the base tag:
If you do not set the target attribute, clicking on the URL will jump directly to the target URL on the original URL. If you want to set it Same as _self.
The other one is the href attribute, which is used to set the URL. With this attribute, when you click the URL, the target URL will be entered in a new window,
is generally used like this:
<base href="//m.sbmmt.com" target="_blank"/>
Copy after login
In fact, there are three more elements, but we are just learning HTML now, so there is no need to know these three, just know it, they are all written In the head tag, let’s give a brief introduction
Okay, now I have almost finished introducing the commonly used head. After reading this, you should be able to use the head tag in HTML correctly. If you have any questions, please ask below[Editor’s related recommendations]
Should hackers learn PHP or python? Rational analysis of ten differences between PHP and python
What is an HTML file? A preliminary understanding of HTML files