.box {
background-color:#CCCCCC;
position:relative;
width:300px;
height:300px;
margin:20px auto;
}
.box:before {
content:"";
box-sizing:border-box;
position:absolute;
top:0;
left:0;
right:0;
bottom:0;
font-size:0;
line-height:0;
border-radius:0;
border:1px solid #F80B0F;
-webkit-transform-origin:0 0;
transform-origin:0 0;
}
@media only screen and (-webkit-min-device-pixel-ratio:1.5),not all {
.box:before {
width:150%;
-webkit-transform:scale(0.66666667);
transform:scale(0.66666667);
}
}@media only screen and (-webkit-min-device-pixel-ratio:2),not all {
.box:before {
width:200%;
-webkit-transform:scale(0.5);
transform:scale(0.5);
}
}@media only screen and (-webkit-min-device-pixel-ratio:3),not all {
.box:before {
width:300%;
-webkit-transform:scale(0.3333);
transform:scale(0.33333);
}
}移动端h5做自适应时通常使用淘宝的flexible方案,在处理手机1px边线通常边线宽高为200%,之后通过transform:scale(.5)来缩放,但是在安卓手机上的自带浏览器(低版本)中,会出现右边线、底边线不能正常显示,亲测手机(华为荣耀9play),通过上述css即可完美解决这一问题。【注意本次针对:使用淘宝flexible方案、ydui布局。其它暂不明确】