


Detailed introduction to HTML head header tag_HTML/Xhtml_Web page production
There are many tags and elements in the HTML head part, which involve browser rendering of web pages, SEO, etc. Each browser core and each domestic browser manufacturer have their own tag elements, which results in a lot of differences. In the era of mobile Internet, the head structure and meta elements of mobile terminals are even more important. Understanding the meaning of each tag and writing a head tag that meets your own needs is the purpose of this article. This article is based on Yishi's article and provides an expanded summary to introduce the meaning and usage scenarios of each tag and element in commonly used heads.
DOCTYPE
DOCTYPE (Document Type), this declaration is located at the frontmost position in the document, before the html tag. This tag tells the browser what kind of HTML the document uses. Or the XHTML specification.
DTD (Document Type Definition) declaration starts with , is not case-sensitive, and has no content in front. If there is other content (except spaces), the browser will open a weird mode under IE ( quirks mode) renders web pages. Public DTD, the name format is registration // organization // type tag // language, registration refers to whether the organization is registered by the International Organization for Standardization (ISO), indicating yes, - indicating no. Organization is the name of the organization, such as: W3C. The type is usually DTD. A tag specifies a description of the public text, that is, a unique descriptive name for the referenced public text, which can be followed by a version number. The final language is the ISO 639 language identifier of the DTD language, such as: EN for English, ZH for Chinese. XHTML 1.0 can declare three DTD types. Represents strict version, transitional version, and frame-based HTML document respectively.
●HTML 4.01 strict
- >
- >
- >
- >
In HTML doctype has two main purposes.
●Verify the validity of documents.
It tells the user agent and validator what DTD this document is written according to. This action is passive. Every time the page is loaded, the browser does not download the DTD and check the validity. It is only enabled when the page is manually verified.
●Determine the browser’s rendering mode
For actual operations, inform the browser which parsing algorithm to use when reading the document. If it is not written, the browser will parse the code according to its own rules, which may seriously affect the html layout. Browsers have three ways to parse HTML documents.
●Non-weird (standard) mode
●Weird mode
●Partially weird (almost standard) mode About IE browser’s document mode, browser mode, strict mode, weird mode, DOCTYPE tag, you can learn more Reading mode? standard! content.
charset
Declare the character encoding used by the document,
- <meta charset="utf-8">
Before html5, the web page would read like this:
- <meta http-equiv="Content-Type " content="text/html; charset=utf-8">
These two are equivalent, please read the details below: vs , so it is recommended to use shorter ones that are easier to remember.
lang attribute
Simplified Chinese
- <html lang="zh-cmn-Hans ">
Traditional Chinese
- <html lang="zh-cmn-Hant ">
Why is lang="zh-cmn-Hans" instead of the lang="zh-CN" we usually write? Please read: Should the statement at the head of the page be lang="zh" or lang="zh-cn".
Prioritize using the latest version of IE and Chrome
- <meta http-equiv="X-UA -Compatible" content="IE=edge,chrome=1" />
360 Using Google Chrome Frame
- <meta name="renderer" content="webkit">
360 browser will immediately switch to the corresponding speed core after reading this tag. Also, just to be on the safe side, join
- <meta http-equiv="X-UA -Compatible" content="IE=Edge,chrome=1">
The effect that can be achieved by writing this way is that if Google Chrome Frame is installed, GCF will be used to render the page. If GCF is not installed, the highest version of the IE kernel will be used for rendering.
Related links: Browser Kernel Control Meta Tag Documentation
Baidu prohibits transcoding
When you open a webpage through Baidu mobile phone, Baidu may modify your webpage Transcode, take off your clothes, and put dog skin plaster ads on your body. For this purpose, you can add
- <meta http-equiv="Cache-Control " content="no-siteapp" />
Related links: SiteApp transcoding statement
SEO optimization part
Page title
- <title>your titletitle >
Page keywords keywords
- <meta name="keywords" content="your keywords">
Page description content description
- <meta name="description" content="your description">
Define web author author
- <meta name="author" content="author,email address">
Define the web search engine indexing method. Robotterms is a set of values separated by English commas ",". It usually has the following values: none, noindex, nofollow, all, index and follow.
XML/HTML CodeCopy content to clipboard
- <meta name="robots" content="index,follow">
Related links: WEB1038 - Tag contains invalid value
viewport
Viewport can make the layout display better on mobile browsers. Usually write
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
width=device-width will cause black borders to appear when the iPhone 5 is added to the home screen and opened in WebApp full-screen mode (http://bigc.at/ios-webapp-viewport-meta.orz )
content parameter:
width viewport width (numeric value/device-width)
height viewport height (numeric value/device-height)
initial-scale initial scaling ratio
maximum-scale maximum scaling ratio
minimum-scale Minimum zoom ratio
user-scalable Whether to allow user scaling (yes/no)
minimal-ui A new attribute in iOS 7.1 beta 2 can minimize the upper and lower status bars when the page is loaded. This is a Boolean value and can be written directly like this:
- <meta name="viewport" content="width=device-width, initial-scale=1, minimal-ui">
And if your website is not responsive, please do not use initial-scale or disable scaling.
- <meta name="viewport" content="width=device-width,user-scalable=yes">
Related links: Viewport with non-responsive design
To adapt to iPhone 6 and iPhone 6plus, you need to write:
XML/HTML CodeCopy content to clipboard
- <meta name="viewport" content="width=375">
- <meta name="viewport" content="width=414">
The viewport width of most 4.7~5-inch Android devices is set to 360px, but it is 375px on iPhone 6. The viewport width of most 5.5-inch Android devices (such as Samsung Note) is 400, and it is 414px on iPhone 6 plus. .
ios device
Title added to the home screen (new in iOS 6)
- <meta name="apple-mobile-web -app-title" content="title">
Whether to enable WebApp full screen mode
- <meta name="apple-mobile-web -app-capable" content="yes" />
Set the background color of the status bar
- <meta name="apple-mobile-web -app-status-bar-style" content="black-translucent" />
Only takes effect when "apple-mobile-web-app-capable" content="yes"
content parameter:
default default value.
black The background of the status bar is black.
black-translucent The background of the status bar is black and translucent. If set to default or black , web content starts from the bottom of the status bar. If set to black-translucent, the web page content fills the entire screen and the top will be obscured by the status bar.
Disable digit recognition as a phone number
- <meta name="format-detection" content="telephone=no" />
iOS icon
rel parameter: apple-touch-icon The image is automatically processed into rounded corners and highlights. apple-touch-icon-precomposed prohibits the system from automatically adding effects and displays the original design directly. iPhone and iTouch, default 57x57 pixels, required
iPad, 72x72 pixels, optional but recommended
Retina iPhone and Retina iTouch, 114x114 pixels, optional but recommended
The iOS icon size is 180×180 on iPhone 6 plus and 120x120 on iPhone 6. To adapt to iPhone 6 plus, you need to add this paragraph
iOS splash screen
Official documentation: https://developer.apple.com/library/ios/qa/qa1686/_index.html
Reference article: http://wxd.ctrip.com/blog/2013/09/ios7-hig-24/
The iPad startup screen does not include the status bar area.
iPad portrait screen 768 x 1004 (standard resolution)
iPad portrait 1536x2008 (Retina)
iPad landscape 1024x748 (standard resolution)
iPad landscape 2048x1496 (Retina)
The startup screen of iPhone and iPod touch includes the status bar area.
iPhone/iPod Touch portrait screen 320x480 (standard resolution)
iPhone/iPod Touch portrait screen 640x960 (Retina)
iPhone 5/iPod Touch 5 vertical screen 640x1136 (Retina)
Add Smart App Banner Smart App Banner (iOS 6 Safari)
The corresponding image size for iPhone 6 is 750×1294, and the corresponding image size for iPhone 6 Plus is 1242×2148.
Windows 8
Windows 8 tile color
Windows 8 tile icon
RSS subscription
favicon icon
For a more detailed introduction to favicon, please refer to https://github.com/audreyr/favicon-cheat-sheet
Mobile meta
XML/HTML CodeCopy content to clipboard
- <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
- <meta name="apple-mobile-web-app-capable" content="yes" />
- <meta name="apple-mobile-web-app-status-bar-style" content="black" />
- <meta name="format-detection"content="telephone=no, email=no" />
- <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
- <meta name="apple-mobile-web-app-capable" content="yes" />
- <meta name="apple-mobile-web-app-status-bar-style" content="black" />
- <meta name="format-detection" content="telphone=no, email=no" />
- <meta name="renderer" content="webkit">
- <meta http-equiv=" " > <
- meta name =
- "HandheldFriendly" content="true">
<
- meta name
=- "MobileOptimized" content="320"> <
- meta name
=- "screen- orientation" content="portrait"> <
- meta name
=- "x5- orientation" content="portrait"> <
- meta name
=- "full- screen" content="yes"> <
- meta name
=- "x5- fullscreen" content="true"> <
- meta name
=- "browsermode" content="application"> <
- meta name
=- "x5- page-mode" content="app">
- <meta name="msapplication- tap-highlight" content="no">
This is a summary of sharing from toobug.
More meta tag references
Reference article:

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Guide to Table Border in HTML. Here we discuss multiple ways for defining table-border with examples of the Table Border in HTML.

This is a guide to Nested Table in HTML. Here we discuss how to create a table within the table along with the respective examples.

Guide to HTML margin-left. Here we discuss a brief overview on HTML margin-left and its Examples along with its Code Implementation.

Guide to HTML Table Layout. Here we discuss the Values of HTML Table Layout along with the examples and outputs n detail.

Guide to the HTML Ordered List. Here we also discuss introduction of HTML Ordered list and types along with their example respectively

Guide to Moving Text in HTML. Here we discuss an introduction, how marquee tag work with syntax and examples to implement.

Guide to HTML Input Placeholder. Here we discuss the Examples of HTML Input Placeholder along with the codes and outputs.

This tutorial demonstrates how to efficiently process XML documents using PHP. XML (eXtensible Markup Language) is a versatile text-based markup language designed for both human readability and machine parsing. It's commonly used for data storage an
