画一条0.5px的边



画一条0.5px的边

问题是在浏览器下0.5px会被直接四舍五入

1:缩放,能否设置1px,然后scale 0.5,指定变换的原点,加上这个transform-origin: 50% 100%;就不会有虚化

height:1px;
transform: scaleY(0.5);
transform-origin: 50% 100%;

2:线性渐变linear-gradient

height: 1px;
background: linear-gradient(0deg, #fff, #000);

3:盒子阴影boxshadow

height: 1px;
background: #000;
box-shadow: 0 0.5px 0 #000;

效果图:

猜你喜欢

转载自blog.csdn.net/weixin_44037936/article/details/84936271