粗暴版
js
<script>
if (/iP(hone|od|ad)/.test(navigator.userAgent)) {
var v = (navigator.appVersion).match(/OS (\d+)_(\d+)_?(\d+)?/),
version = parseInt(v[1], 10);
if(version >= 8){
document.documentElement.classList.add('hairlines')
}
}
</script>
css
/*1px hack*/
.hairlines * {
border-width: 0.5px !important;
}
或者用伪类
&::before {
content: "";
position: absolute;
left: 0;
width: 200%;
height: 0;
border-bottom: 1px solid #dedede;
transform-origin: left top;
transform: scale3d(0,0.5,0.5);
-webkit-transform: scale3d(0.5,0.5,0.5); /* Chrome, Safari, Opera */
-ms-transform: scale3d(0,0.5,0.5); /* IE 9 */
}