


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
- /span>>
- /span>>
- /span>>
- /span>>
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:

HTML is the cornerstone of building web page structure. 1. HTML defines the content structure and semantics, and uses, etc. tags. 2. Provide semantic markers, such as, etc., to improve SEO effect. 3. To realize user interaction through tags, pay attention to form verification. 4. Use advanced elements such as, combined with JavaScript to achieve dynamic effects. 5. Common errors include unclosed labels and unquoted attribute values, and verification tools are required. 6. Optimization strategies include reducing HTTP requests, compressing HTML, using semantic tags, etc.

HTML is a language used to build web pages, defining web page structure and content through tags and attributes. 1) HTML organizes document structure through tags, such as,. 2) The browser parses HTML to build the DOM and renders the web page. 3) New features of HTML5, such as, enhance multimedia functions. 4) Common errors include unclosed labels and unquoted attribute values. 5) Optimization suggestions include using semantic tags and reducing file size.

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

The role of HTML is to define the structure and content of a web page through tags and attributes. 1. HTML organizes content through tags such as , making it easy to read and understand. 2. Use semantic tags such as, etc. to enhance accessibility and SEO. 3. Optimizing HTML code can improve web page loading speed and user experience.

HTMLisaspecifictypeofcodefocusedonstructuringwebcontent,while"code"broadlyincludeslanguageslikeJavaScriptandPythonforfunctionality.1)HTMLdefineswebpagestructureusingtags.2)"Code"encompassesawiderrangeoflanguagesforlogicandinteract

HTML, CSS and JavaScript are the three pillars of web development. 1. HTML defines the web page structure and uses tags such as, etc. 2. CSS controls the web page style, using selectors and attributes such as color, font-size, etc. 3. JavaScript realizes dynamic effects and interaction, through event monitoring and DOM operations.

HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.

HTML is suitable for beginners because it is simple and easy to learn and can quickly see results. 1) The learning curve of HTML is smooth and easy to get started. 2) Just master the basic tags to start creating web pages. 3) High flexibility and can be used in combination with CSS and JavaScript. 4) Rich learning resources and modern tools support the learning process.


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

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

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment