1、0.5px的线
核心代码就是通过transfrom的scaleY属性,溢出隐藏掉就可以了
// html
<div class="line"></div>
<div style="height:100px;width:100px"></div>
<div class="line-copy"></div>
//css
.line {
width: 1000px;
height: 1px;
background: #000;
transform: scaleY(0.5);
overflow: hidden;
}
.line-copy {
width: 1000px;
height: 1px;
background: #000;
}
2、微信小程序0.5rpx边框
// css样式
.line_box {
position: relative;
width: 690rpx;
height: 50rpx;
}
.line_box::after {
position: absolute;
top: 0;
left: 0;
content: " ";
width: 100%;
height: 1rpx;
border-top: 1px solid #dedede;
transform: scaleY(.5);
}