您的位置:首页 > 移动开发

css 移动端1px的解决方案

2017-06-22 16:37 253 查看
.wi-cell {
position: relative;
}
.wi-cell:before {
content: " ";
position: absolute;
left: 0;
top: 0;
right: 0;
height: 1px;
border-top: 1px solid #e5e5e5;
color: #e5e5e5;
-webkit-transform-origin: 0 0;
transform-origin: 0 0;
-webkit-transform: scaleY(0.5);
transform: scaleY(0.5);
left: 15px;
}

原理:父级设置相对定位,通过伪类来给父级添加子元素设置相对于父级的绝对定位,设置其高为一个像素,然后设置上边框也为一个像素,最后通过 CSS3 的 transform 属性把伪元素缩放为原来的一半大小。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  css3