meta element in HTML

<Meta> element must be placed in <head> tags, and must be written in the HTML file within the first 1024B

The main purpose of <meta> element is to provide relevant information on this HTML document. Encoding e.g., author information, keyword information, or redirect URL to direct the user to another URL like.

A <head> tag within the plurality <meta> element is present.

The following is reproduced from https://www.jianshu.com/p/6549bec5d0e1

The role of meta tags

  • Search engines (SEO) optimization;
  • Define the page language;
  • Automatic refresh the page;
  • Control the page cache;
  • Web page classification evaluation;
  • Control page window display;
  • and many more...

Use meta

<meta>There are three tag attributes, different attributes and values ​​make up a different page functions:

  • name
  • http-equiv
  • content

The name attribute

nameThe main attribute is used to describe a web page, the corresponding contentcontent attribute is to facilitate the search engines to find and categorize information. grammar:

<meta name="" content="" /> 

name="keywords"

It is used to set, let search engine to find keyword page:

<meta name="keywords" content="活动,聚会,拓展,团建,培训,讲座" /> 

name="description"

It is used to set, let search engines access to content pages of description:

<meta name="description" content="百场汇是中国最大的会议活动和工作场地短租平台,提供场地直销服务,价格超低,无任何附加费用,帮助用户寻找各种各样的特色场地。" /> 

name="robots"

It is used to set, let search engines which pages to index, which does not require an index page. contentIt has the following parameters:

  • all: the file will be retrieved, and the links on the page can be inquiries;
  • none: document will not be retrieved, and the links on the page can not be queried;
  • index: files will be retrieved;
  • noindex: document will not be retrieved, but the links on the page can be inquiries;
  • follow: a link on the page can be inquiries;
  • nofollow: document will be retrieved, but the link on the page can not be queried.

<meta name="robots" content="all" /> 

name="author"

It is the author sets the page:

<meta name="author" content="jay" /> 

name="generator"

It is to set up the site using what software to make:

<meta name="generator" content="hobbit" /> 

name="COPYRIGHT"

It is to set the copyright information of the website:

<meta name="COPYRIGHT" content="百场汇" /> 

name="revisit-after"

It is set to revisit the site, 30dayon behalf of 30 days:

<meta name="revisit-after" content="30day" /> 

name="viewport"

It is used to control the browser window size and scale, since it in modern browsers, especially the Mobile client browser is very common, we will use a dedicated an article to explain it:

<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" /> 

http-equiv attribute

http-equivHTTP is equivalent to setting the file header. grammar:

<meta http-equiv="" content="" /> 

http-equiv="expires"

It is to set the expiration time of the page:

<meta http-equiv="expires" content="Fri May 13 2016 22:49:44 GMT+0800 (CST)" /> 

http-equiv="Pragma"

It is prohibited to set the browser to access the page from the local cache:

<meta http-equiv="Pragma" content="no-cache" /> 

http-equiv="Refresh"

It is set to automatically refresh and jump to a new page where contentthe first number represents five seconds automatically refresh:

<meta http-equiv="Refresh" content="5;URL=http://m.baichanghui.com" /> 

http-equiv="Set-Cookie"

It is set to Cookie's:

<meta http-equiv="Set-Cookie" content="cookie value=xxx;expires=Friday,12-Jan-200118:18:18GMT;path=/" /> 

http-equiv="content-Type"

It is to set the character set used by page:

<meta http-equiv="content-Type" content="text/html;charset=gb2312" /> 

http-equiv="Content-Language"

It is to set the page language:

<meta http-equiv="Content-Language" content="zh-cn" /> 



Guess you like

Origin www.cnblogs.com/xiaohaodeboke/p/12150415.html