0.5px border 实现方案

<div class='thin-border'></div>orm

 

.thin-border {it

  position: relative;io

  width: 40px;form

  height: 20px;class

}transform

.thin-border::after {top

  content: ' ';di

  position: absolute;vi

  left: 0;co

  top: 0;

  border: '1px solid #000';

  border-radius: 4px;

  box-sizing: border-box;

  width: 200%;

  height: 200%;

  transform: scale(.5);

  transform-origin: left top;

}

在使用前能够先增长 window.devicePixelRatio && window.devicePixelRatio >= 2 的判断,建议像素比在 2 及已上时使用

相关文章
相关标签/搜索