.divpx:after{
display: inline-block;
width: 200%;
position: relative;
border-top: 1px solid black;
content: '';
transform:scale(.5);
transform-origin: left top;
}
效果
原理很简单,长度设置为原元素的200%,然后通过transform的缩放功能,把整个缩放成0.5倍,1px自然就成了0.5px,图中代码缺一不可
在dpr不同的设备可以通过媒体查询来完成更加细致的操作