HTML header element

HTML element

element is a container for all head elements. The head element tag content includes , <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.</p> <p><title> The element tag defines the title of the document.<br><base>Element tag: Specifies the default address or default target (target) for all links on the page.<br><link>The element tag defines the relationship between the document and external resources. Most commonly used to connect style sheets.<br><script>The element tag is used to define client-side scripts, such as JavaScript.<br><style>The element tag is used to define style information for HTML documents. The<br><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.)</p> <p># & lt; meta & gt; Specify attribute value<br>scheme="" Name a scheme for interpreting the attribute value<br>using using this attribute. through out using off ‐ through ‐ ‐ ‐‐ ‐‐ ‐‐‐‐‐‐ and dir ="" Specify text direction<br><br><br><br>Knowledge point 1: Set the base URL of the web page in the header information</p> <p><span style="font-size: 18px;"><strong>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.</strong></span></p> <p>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:</p> <pre class="brush:php;toolbar:false"><html> <head> <title>基底网址的设置 //m.sbmmt.com" _target="_blank" />

Set the base URL through the above code. The address of any hyperlink in the Base.htm page will be preceded by "//m.sbmmt.com", 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 , 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 , 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 . 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

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 , 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 means interval Refresh once every 30 seconds. The second writing format is , 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.
<1>To add CSS, just add the tag pair in the header information. The sample code is as follows

  CSS的设置  

<2>To add JavaScript, just add


Continuing Learning
||
php中文网(php.cn)

本文档的 meta 属性描述了该文档和它的关键词。

submit Reset Code
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!