HTML header element
HTML <head> element
<head> element is a container for all head elements. The head element tag content includes <title>, <base>, <link>, <meta>, <script> and <style>. Except for the content of the <title> tag that will be displayed, the remaining tag content is hidden information.
<title> The element tag defines the title of the document.
<base>Element tag: Specifies the default address or default target (target) for all links on the page.
<link>The element tag defines the relationship between the document and external resources. Most commonly used to connect style sheets.
<script>The element tag is used to define client-side scripts, such as JavaScript.
<style>The element tag is used to define style information for HTML documents. The
<meta> tag is used to describe the hidden information of an HTML web page document, such as author, date and time, web page description, keywords, page refresh, etc. Meta is mainly divided into HTTP header information (http-equiv) and page description information (name). Header information includes document type, character set, language, and other information and processing actions for the browser to correctly display the web page; page descriptions such as content keywords, abstracts, authors, and definition of robots behavior provide information for search engine indexing. (Some search engines will use the name and content attributes of Meta elements to index pages.)
# & lt; meta & gt; Specify attribute value
scheme="" Name a scheme for interpreting the attribute value
using using this attribute. through out using off ‐ through ‐ ‐ ‐‐ ‐‐ ‐‐‐‐‐‐ and dir ="" Specify text direction
Knowledge point 1: Set the base URL of the web page in the header information
The essence of the base URL is unified setting Attributes of hyperlinks, the base URL tag is </base>, which has two attributes, href and _target. href is used to set the path of the base URL, and _target is used to set the opening method of the hyperlink. By adding the base URL, all relative website root addresses in the page can be converted into absolute addresses. When the browser browses the page, the relative website and directory address are appended to the back of the base URL path through the <base> tag, thereby converting it into an absolute address. We first create a base.htm and write the HTML code as follows: Set the base URL through the above code. The address of any hyperlink in the Base.htm page will be preceded by "http://www.php.cn", which is converted to an absolute address. Moreover, the hyperlinks on the page are opened in new windows. Knowledge point 2: Meta-information tag of header information Meta-information tag is the basic of header information Tags and professional webpage codes have detailed settings for meta information. The meta information tag is </meta>, which is a single tag. The information provided by the Meta element is invisible to browsing users and is generally used to define the name, keywords, author, etc. of page information. In an HTML page, a meta tag contains a meta content, and there can be multiple meta elements in an HTML header page. meta tag attributes are divided into two types: page description attribute (name) and http title information (http-equiv). name attribute The name attribute is mainly used to describe the content of the web page and is used for search engine optimization. It must be mastered. Set the name attribute correctly so that the search robots of search engines (such as Google and Baidu) can find and classify the web pages. Search engines will generally automatically find the meta value to classify web pages. The value of name is as follows: <1>keywords. That is, keywords are used to describe the keywords and other information contained in the web page, thereby increasing the probability of being searched by search engines. The writing format is <meta name="keywords" content = "keywords"/>, and the value of the content attribute is the specific keyword set by the user. (Generally, multiple keywords can be set, separated by English half-width commas. Search engines limit the number of keywords, so the keyword content should be concise and concise) <2>description. It means "description" in Chinese and is used to describe the main content, theme, etc. of a web page. Reasonable settings can also increase the probability of being searched by search engines. The format is <meta name="description" content = "Description of the page"/>. The content attribute value is the specific description of the page set by the user. It can accommodate up to 1024 characters, but the search engine only displays about the first half of the page. 175 characters. <3>author. Author, used to set the name of the website author, often used by more professional websites. The format is <meta name="author" content ="author name"/> http-equiv attribute The value of the http-equiv attribute is as follows : <1>content-type, content category, used to set the category and language character set of the page. Writing format <meta http-equiv="content-type" context="text/html"; charset="gb2312"/>, the value of the content attribute represents that the page is output in HTML code, and the character set is gb2312 (Simplified Chinese) , for international website development, in order to unify characters, it is recommended to use utf-8. <2>refresh for charset. Refresh is used to set how long the webpage refreshes itself, or automatically jumps to other pages within a period of time. The first writing format <meta http-equiv="refresh" context="30"/> means interval Refresh once every 30 seconds. The second writing format is <meta http-equiv="refresh" context="30; url=www.google.com"/>, which means the page will automatically jump to www.google after 30 seconds. com website Knowledge point three: header information implementation and mixing with CSS and JavaScript CSS is responsible for the style of the HTML web page, and JavaScript is responsible for the HTML Dynamic behavior of web pages. The most common way to integrate CSS and JavaScript is to write the header information. <2>To add JavaScript, just add <script type="text/javascript">< to the header information /script> tag pair. The sample code is as follows: <html>
<head>
<title>基底网址的设置</title>
<base href="<a href="http://www.php.cn">http://www.php.cn</a>" _target="_blank" />
</head>
<body>
</body>
</html>
<1>To add CSS, just add the <style type="text/css"></style> tag pair in the header information. The sample code is as follows<html>
<head>
<title>CSS的设置</title>
<style type=“text/css”> CSS具体内容 </style>
</head>
<body>
</body>
</html>
<html>
<head>
<title>CSS的设置</title>
<style type=“text/css”>
CSS具体内容
</style>
<script type=“text/javascript”>
JavaScript具体内容
</script>
</head>
<body>
</body>
</html>