< meta > elements

Source: Internet
Author: User

Profile

The tag provides metadata about the HTML document. The metadata is not displayed on the page, but is readable for the machine. It can be used in browsers (how to display content or reload pages), search engines (keywords), or other Web services. --w3school

Required Attributes

Properties value Description
Content Some text Define meta information related to the HTTP-EQUIV or Name property

Optional properties

Properties value Description
Http-equiv Content-type/expire/refresh/set-cookie Associate the Content property to the HTTP header.
Name Author/description/keywords/generator/revised/others Associate the Content property to a name.
Content Some text Defines the format used to translate content property values.
SEO optimization

Reference documents

    • page Keywords , each page should have a unique set of keywords that describe the content of the page.
      Use descriptive and Representative keywords and phrases that people may search for and accurately describe the information provided on the page. Tag content is too short, the search engine may not think of the content as relevant. Additional tokens should not exceed 874 characters.
<meta name="keywords" content="your tags" />
    • page Description , each page should have a no more than 150 characters and can accurately reflect the content of the page description tag.
<meta name="description" content="150 words" />
    • search Engine Indexing method , Robotterms is a set of values separated by commas (,), usually have the following values: None,noindex,nofollow,all,index and follow. Make sure that the nofollow and Noindex property values are used correctly.
<meta name="robots" content="index,follow" /><!-- all:文件将被检索,且页面上的链接可以被查询; none:文件将不被检索,且页面上的链接不可以被查询; index:文件将被检索; follow:页面上的链接可以被查询; noindex:文件将不被检索; nofollow:页面上的链接不可以被查询。 -->
    • page redirection and refresh : The number within the content represents the time (in seconds) that is refreshed after a few minutes. If the URL is added, it is redirected to the specified Web page (search engines can be automatically detected and easily punished by the engine as misleading).
<meta http-equiv="refresh" content="0;url=" />
    • Other
<Metaname= "author" content= "author name"/> <!--definition Web page author--><< Span class= "Hljs-title" >meta name= "google" content=" Index,follow "/>< meta name= "Googlebot" content= "Index,follow"/><meta name=" verify " content= "Index,follow"/>       
Mobile devices
    • viewport: Can optimize the display of mobile browser. If it is not a responsive web site, do not use Initial-scale or disable scaling.
      Most of the 4.7-5-inch devices have a viewport width of 360px;5.5 inch set to 400px;iphone6 set to 375px;ipone6 plus set to 414px.
<meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=no"/><!-- `width=device-width` 会导致 iPhone 5 添加到主屏后以 WebApp 全屏模式打开页面时出现黑边 -->
    1. Width: widths (values/device-width) (range from 200 to 10,000, default to 980 pixels)
    2. Height: Altitude (Value/device-height) (range from 223 to 10,000)
    3. Initial-scale: Initial zoom ratio (range from >0 to 10)
    4. Minimum-scale: The minimum scale to allow the user to zoom
    5. Maximum-scale: Allows the user to zoom to the maximum scale
    6. User-scalable: Whether the user can manually indent (no,yes)
    7. Minimal-ui: You can minimize the upper and lower status bar when the page loads. (deprecated)

Note that many people use initial-scale=1 to non-responsive websites, which makes the site render at 100% width, and the user needs to manually move the page or zoom. If you use User-scalable=no or maximum-scale=1 with initial-scale=1 at the same time, users will not be able to zoom in/out of the page to see all the content.

    • WebApp Full Screen mode : Fake app, offline app.
<meta name="apple-mobile-web-app-capable" content="yes" /> <!-- 启用 WebApp 全屏模式 -->
    • Hide Status bar/Set status bar color : Only takes effect when webapp full screen mode is turned on. The content value is default | Black | Black-translucent.
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
    • Title after adding to the main screen
<meta name="apple-mobile-web-app-title" content="标题">

    • Ignore numbers automatically recognized as phone numbers
<meta content="telephone=no" name="format-detection" /> 
    • Ignore recognition mailboxes
<meta content="email=no" name="format-detection" />
    • Add Smart App banner Smart app Banner: Tell the browser the app that corresponds to this website and display the download Banner (for example) on the page. Reference documents
<meta name="apple-itunes-app" content="app-id=myAppStoreID, affiliate-data=myAffiliateData, app-argument=myURL"> 

    • Other reference documents
<!--optimized for handheld devices, mainly for older browsers that do not recognize viewport, such as BlackBerry--and<MetaName="Handheldfriendly"Content="True" ><!--Microsoft's Vintage browser--<MetaName="Mobileoptimized"Content=">"<!--UC Force vertical screen--<MetaName="Screen-orientation"Content="Portrait" ><!--QQ Forced vertical screen--<MetaName="X5-orientation"Content="Portrait" ><!--UC Mandatory fullscreen--<MetaName="Full-screen"Content="Yes" ><!--QQ Mandatory fullscreen--<MetaName="X5-fullscreen"Content="true" ><!--UC App mode--<meta name= "Browsermode"  content="Application" ><!--QQ App mode--<meta name="X5-page-mode" content="app" ><! --Windows Phone Click No Highlight-<meta name="msapplication-tap-highlight" content="No" >                   
Web related
    • Declaration Code
<meta charset=‘utf-8‘ />
    • Use the latest version of IE and Chrome first
<Metahttp-equiv="X-ua-compatible"Content="Ie=edge,chrome=1"/><!--about x-ua-compatible-->< Meta http-equiv= "x-ua-compatible" content= "ie=6" ><!-- Use IE6--><meta http-equiv=< Span class= "Hljs-value" > "x-ua-compatible" content= "IE=7" ><!--use IE7--><meta http-equiv= "x-ua-compatible"  Content= "ie=8" ><!--use IE8-->     
    • Browser Kernel control : Many domestic browsers are dual-core (WebKit and Trident), WebKit kernel high-speed browsing, IE core-compatible Web pages and the old version of the site. Web sites that add Meta tags can control what kernel rendering the browser chooses. Reference documents
<meta name="renderer" content="webkit|ie-comp|ie-stand">

The default kernel mode for dual-core browsers is as follows:
1. Sogou high-speed browser, QQ browser: IE core (compatibility mode)
2.360 Speed Browser, roaming browser: WebKit kernel (fast mode)

    • prevents browsers from accessing page content from the local computer's cache : This setting allows visitors to browse offline.
<meta http-equiv="Pragma" content="no-cache">
    • Windows 8
<meta name="msapplication-TileColor" content="#000"/> <!-- Windows 8 磁贴颜色 --><meta name="msapplication-TileImage" content="icon.png"/> <!-- Windows 8 磁贴图标 -->
    • site adaptation : Mainly used for pc-mobile phone page of the corresponding relationship.
<meta name="mobile-agent"content="format=[wml|xhtml|html5]; url=url"><!--[wml|xhtml|html5]根据手机页的协议语言,选择其中一种;url="url" 后者代表当前PC页所对应的手机页URL,两者必须是一一对应关系。 -->
    • transcoding declaration : Using Baidu to open the Web page may be transcoded (such as stickers), to avoid transcoding can add the following meta
<meta http-equiv="Cache-Control" content="no-siteapp" />

Attributes
Attribute Value Description
CONTENT String Specifies the meta information or value to is associated with NAME or http-equiv attributes.
Http-equiv String Specifies the name used to gather information for HTTP response message headers. If Required, theCONTENTattribute specifies the value.

Primarily used for server information, Internet Explorer Mobile recognizes REFRESH, NOSCRIPT and CL Eartype.

REFRESH Specifies the number of seconds before the document is refreshed. URL is optional and contains the URL of the document to being loaded on refresh.

CLEARTYPE Specifies that CLEARTYPE are to being turned on or off.

Examples:

<meta http-equiv= "REFRESH" content= "2" > causes the document to be refreshed every.

<meta http-equiv= "REFRESH" content= "2; url=http://www.tailspintoys.com/"> causes the specified URL to is loaded after the seconds.

<meta http-equiv= "NOSCRIPT" > causes Scripts to being disabled on the that page.

<meta http-eqiv= "ClearType" content= "on" > causes ClearType to being turned on.

NAME String Specifies the property name. This can take any value and there is no specification of legal values. The CONTENT attribute specifies the property ' s value.

Internet Explorer Mobile recognizes the. Use of mobileoptimized. If you have optimized your content for mobile devices, the use of this value would override the automatic resizing process. The CONTENT attribute contains the device screen width.

Example:

<meta name= "mobileoptimized" content= "up" > causes the browser is not automatically resizing the document.

 

< meta > element

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.