zoukankan      html  css  js  c++  java
  • 移动端注意事项

    一、关于meta
     
    (一)、常用的公共meta属性
     
    1、viewport
     
    <metaname="viewport"content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0"/>
    
    width=device-width   宽度是设备屏幕的宽度(像素)
    height=device-height 高度是设备屏幕的高度(像素)
    initial-scale     初始的缩放比例
    minimum-scale     允许用户缩放到的最小比例
    maximum-scale     允许用户缩放到的最大比例
    user-scalable     用户是否可以手动缩放
    2、Format-detection
     
    format-detection翻译成中文的意思是“格式检测”,顾名思义,它是用来检测html里的一些格式的,那关于meta的format-detection属性主要是有以下几个设置:
    meta name="format-detection" content="telephone=no"
    meta name="format-detection" content="email=no"
    meta name="format-detection" content="adress=no"
    也可以连写:meta name="format-detection" content="telephone=no,email=no,adress=no"
     
    一般只要禁用手机拨号即可
    3、http-equiv
     
    http-equiv顾名思义,相当于http的文件头作用,它可以向浏览器传回一些有用的信息,以帮助正确和精确地显示网页内容,与之对应的属性值为content,content中的内容其实就是各个参数的变量值。 meat标签的http-equiv属性语法格式是:<meta http-equiv="参数" content="参数变量值"> ;

     <meta http-equiv=X-UA-Compatible content="IE=edge,chrome=1">

    (二)、IOS私有meta属性
     

    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    (四)、其他浏览器私有meta属性【除非特需,一般不推荐使用】
     
    1、QQ浏览器私有

    全屏模式
    <meta name="x5-fullscreen" content="true">

    强制竖屏
    <meta name="x5-orientation" content="portrait">
     

    强制横屏
    <meta name="x5-orientation" content="landscape">
     

    应用模式
    <meta name="x5-page-mode" content="app">
    2、UC浏览器私有

    全屏模式
    <meta name="full-screen" content="yes">

    强制竖屏
    <meta name="screen-orientation" content="portrait">

    强制横屏
    <meta name="screen-orientation" content="landscape">

    应用模式
    <meta name="browsermode" content="application">
    二、关于样式
     
    1、上下拉动滚动条时卡顿、慢

    body {
           -webkit-overflow-scrolling: touch;
           overflow-scrolling: touch;
    }


    2、禁止复制、选中文本

    Element {
           -webkit-user-select: none;
           -moz-user-select: none;
           -khtml-user-select: none;
             user-select: none;
    }
    解决移动设备可选中页面文本(视产品需要而定)


    3、长时间按住页面出现闪退

    element {
           -webkit-touch-callout: none;
    }

    4、iphone及ipad下输入框默认内阴影

    Element{
           -webkit-appearance: none;
    }
     
     

    5、ios和android下触摸元素时出现半透明灰色遮罩

    Element {
           -webkit-tap-highlight-color:rgba(255,255,255,0)
    }
    设置alpha值为0就可以去除半透明灰色遮罩,备注:transparent的属性值在android下无效。

    后面一篇文章有详细介绍,地址:http://www.haorooms.com/post/phone_web_ysk
     


    6、active兼容处理

    <body ontouchstart="">
     

    7、动画定义3D启用硬件加速

    Element {
           -webkit-transform:translate3d(0, 0, 0)
           transform: translate3d(0, 0, 0);
    }
    注意:3D变形会消耗更多的内存与功耗


    8、Retina屏的1px边框

    Element{
           border- thin;
    }

    9、旋转屏幕时,字体大小调整的问题

    html, body, form, fieldset, p, div, h1, h2, h3, h4, h5, h6 {
           -webkit-text-size-adjust:100%;
    }

    10、transition闪屏

    /设置内嵌的元素在 3D 空间如何呈现:保留3D /

    -webkit-transform-style: preserve-3d;
     

    / 设置进行转换的元素的背面在面对用户时是否可见:隐藏 /

    -webkit-backface-visibility:hidden;
     

    11、圆角bug

    某些Android手机圆角失效

    background-clip: padding-box;
    日常所遇,随手而记。
  • 相关阅读:
    华为測试 字符串运用-password截取
    海量路由表能够使用HASH表存储吗-HASH查找和TRIE树查找
    MapReduce源代码浅析
    POJ 2524 并查集
    unity3d 建树篇
    mysql 自己定义存储过程和触发器
    如何在线缩小jpg图片的大小
    Winodws安装系统时,通过安装磁盘进行分区
    新年新气象
    java.lang.ClassNotFoundException与java.lang.NoClassDefFoundError的区别
  • 原文地址:https://www.cnblogs.com/zhihou/p/7997602.html
Copyright © 2011-2022 走看看