移动端 常用css重置

2019-12-26  本文已影响0人  squidbrother
-webkit-user-select: none; 
-ms-user-select: none;
-moz-user-select: none;
-khtml-user-select: none;
user-select: none;
-webkit-touch-callout:none;
-webkit-tap-highlight-color: rgba(0,0,0,0);
或
-webkit-tap-highlight-color: transparent;
-moz-user-focus: none;
outline:none;
-webkit-appearance: none;
-moz-appearance: none; /* Firefox */
appearance: none; /* Safari 和 Chrome */
over-flow: auto;     /* winphone8和android4+ */
webkit-overflow-scrolling: touch; /* ios5+ */
  *{ touch-action: manipulation }
#someDom {
  touch-action: none;
}
img { object-fit: cover; }

示例:

img { width: 200px; height: 200px; object-fit: cover; }
图片非拉伸裁切
.css {
    -webkit-transform: translate3d(0,0,0);
    -moz-transform: translate3d(0,0,0);
    -ms-transform: translate3d(0,0,0);
    transform: translate3d(0,0,0);
}
或
.css {
    -webkit-transform-style: preserve-3d;
    -webkit-backface-visibility: hidden;
    -webkit-perspective: 1000;
}

注:硬件加速会导致 CPU 性能占用量过大,电池电量消耗加大 ;因此尽量避免泛滥使用硬件加速

上一篇 下一篇

猜你喜欢

热点阅读