meta总结 - beidan

WBOY
Release: 2016-05-22 17:19:53
Original
1400 people have browsed it

做项目的时候发现正常的代码在360浏览器上样式都是乱的,翻阅资料才发现360是双核,分为极速模式和兼容模式,极速模式是用webkit内核,兼容模式是用trident内核(也就是IE内核),最后加了一行代码就完美解决了

1 meta name="renderer" content = "webkit"/>
Copy after login
竟然一行代码“功力这么强大”,真是有必要认真学习了解一下常用的head头标签了。
首先,总结一下浏览器默认的内核模式:

国内双核浏览器默认内核模式如下:
1. 搜狗高速浏览器、QQ浏览器:IE内核(兼容模式)
2. 360极速浏览器、遨游浏览器:Webkit内核(极速模式)

1.搜索引擎 (SEO优化)

 页面关键字

meta name="keywords" content="技术">
Copy after login

页面描述

meta name="description" content = "搜索相关课程">
Copy after login

2.移动设备

meta name="viewport" content="">
Copy after login

设置屏幕宽度为设备宽度,禁止用户手动调整缩放

meta name = "viewport" content="width=device-width,user-scalable=no">
Copy after login
  1. device-width   为设备的宽度

  2. user-scalable   用户调整缩放,yes为允许用户对其缩放,反之为no,若设置为no,minimum-scale和maximum-scale都将被忽略,因为根本不可以缩放。

  3. initial-scale:初始的缩放比例 (范围从>0 到10)

3.声明编码

    

 

4.内核设置

优先使用IE最新版本和Chrome

浏览器内核控制:(国内很多是双内核(webkit,trident)添加以下meta可以控制浏览器使用何种内核渲染)

meta name="renderer" content = "webkit | ie-comp| ie-stand"/>
Copy after login

content的取值为 webkit   ie-comp  ie-stand, (是区分大小写的,使用的时候要注意),分别代表webkit 内核,IE 兼容内核,IE 标准内核。

如:若页面需默认用极速核,增加标签:

5.缓存设置

禁止浏览器从本地计算机的缓存中访问页面内容:

6.手机端常用设置

H5页面窗口自动调整到设备宽度,并禁止用户缩放页面

1 meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
Copy after login

忽略将页面中的数字识别为电话号码

1 meta name="format-detection" content="telephone=no" />
Copy after login

忽略Android平台中对邮箱地址的识别

1 meta name="format-detection" content="email=no" />
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!