理论上最小的单位是1px
一、最优方法:transforms属性缩放
<!DOCType html> <html> <head> <meta charset="utf-8"> <style> .hr { width: 300px; background-color: #000; } .scale-half { height: 1px; transform: scaleY(0.5); /* 延Y轴缩小1倍 */ transform-origin: 50% 100%; /* 改变元素变形的原点 */ } .hr.half-px { height: 0.5px; } .hr.one-px { height: 1px; } </style> </head> <body> <p>1px + scaleY(0.5)</p> <div class="hr scale-half"></div> <p>0.5px</p> <div class="hr half-px"></div> <p>1px</p> <div class="hr one-px"></div> </body> </html>
参考:(4条消息) 【css】画一条0.5px的直线_css如何画一个0.3px线_a堅強的泡沫的博客-CSDN博客
标签:hr,px,0.5,transform,height,1px,CSS From: https://www.cnblogs.com/le-cheng/p/17492927.html