物理像素指的是分辨率,iPhone6/7/8 手机分辨率是 750*1334
iPhone6/7/8 手机 4.6 英寸,根据设备大小转换成像素是 375*667
通常说在页面显示宽高 100px 的元素,这里的像素指的是设备像素
设备像素比 device pixel ratio 简称 dpr,即物理像素和设备像素的比值。
750/375=2
那么1个设备像素里面有4个物理像素
常常说 iPhone 是两倍高清屏就是这个意思
UI 给设计稿必须也是 750*1334 的大小,按照大尺寸去设计,避免图片模糊,到时候再进行转换。
.border_1px:before{
content: '';
position: absolute;
top: 0;
height: 1px;
width: 100%;
background-color: #000;
transform-origin: 50% 0%;
}
@media only screen and (-webkit-min-device-pixel-ratio:2){
.border_1px:before{
transform: scaleY(0.5);
}
}
@media only screen and (-webkit-min-device-pixel-ratio:3){
.border_1px:before{
transform: scaleY(0.33);
}
}
