zoukankan      html  css  js  c++  java
  • 关于浏览器兼容问题——还有移动端meta问题

    <!DOCTYPE html>
    <!--[if lt IE 7]> <html dir="ltr" lang="en-US" class="ie6"> <![endif]-->
    <!--[if IE 7]> <html dir="ltr" lang="en-US" class="ie7"> <![endif]-->
    <!--[if IE 8]> <html dir="ltr" lang="en-US" class="ie8"> <![endif]-->
    <!--[if gt IE 8]><!--> <html dir="ltr" lang="en-US"> <!--<![endif]-->
    <!-- BEGIN head -->

    <head>


    总之,就是在<!DOCTYPE html>与<head>中间的东西加入
    <!--[if lt IE 7]> <html dir="ltr" lang="en-US" class="ie6"> <![endif]-->
    <!--[if IE 7]> <html dir="ltr" lang="en-US" class="ie7"> <![endif]-->
    <!--[if IE 8]> <html dir="ltr" lang="en-US" class="ie8"> <![endif]-->
    <!--[if gt IE 8]><!--> <html dir="ltr" lang="en-US"> <!--<![endif]-->
    这一大串就OK了,感觉自己棒棒哒~当然可能部分地方还需要修改

    还有就是让网页适应移动端加个meta标签:

    a、<!-- 强制让文档与设备的宽度保持1:1 -->
    <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no">

    禁止Html5在手机上屏幕页面缩放

    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" name="viewport" />


    网页宽度默认等于屏幕宽度(width=device-width),
    初始缩放比例(initial-scale=1)为1.0,即网页初始大小占屏幕面积的100%。

    b、<!-- 删除默认的苹果工具栏和菜单栏 -->
    <meta name="apple-mobile-web-app-capable" content="yes">


    c、<!-- 在web app应用下状态条(屏幕顶部条)的颜色 -->
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />


    d、<!-- 禁止了把数字转化为拨号链接 -->
    <meta name="format-detection" content="telephone=no">
    e、<!-- 浏览网站时的小图标 -->
    <link rel="shortcut icon" href="http://p.www.xiaomi.com/favicon.ico" type="/image/x-icon">


    f、<!-- 添加至主屏时的图片 -->
    <link rel="apple-touch-icon-precomposed" href="http://a.tbcdn.cn/mw/s/hi/tbtouch/images/touch-icon.png">


    ==================
    还有一种有趣的方法
    创建html5时发现这么一句话,如下:
    <meta http-equiv=”X-UA-Compatible” content=”IE=edge,chrome=1″/>


    这样写可以达到的效果是如果安装了GCF(Google Chrome Frame 谷歌内嵌浏览器框架的简称),则使用GCF来渲染页面,如果没安装GCF,则使用最高版本的IE内核进行渲染。这个插件可以让用户的IE浏览器外不变,但用户在浏览网页时,实际上使用的是Google Chrome浏览器内核,而且支持IE6、7、8等多个版本的IE浏览器。

  • 相关阅读:
    es6 扩展运算符 ...
    回顾2018,展望2019
    vue 兼容IE报错解决方案
    错误的理解引起的bug async await 执行顺序
    js async await 终极异步解决方案
    javascript 之继承-15
    javascript 之原型、原型链-14
    vue入门学习篇——初识vue
    模拟实现select组件功能
    ie8绝对定位存在的坑
  • 原文地址:https://www.cnblogs.com/fkcqwq/p/5395432.html
Copyright © 2011-2022 走看看