1px边框在pc端中就是实打实的1px,那么在移动端呢?跟devicePixelRatio值有关,devicePixelRatio值为多少,实际1px在移动端就要用1px*devicePixelRatio,那么这种情况该如何解决呢?
HTML:
<div class="btn">我是按钮</div>
CSS:
.btn{margin: 50px auto; 200px;height: 42px;-webkit-border-radius: 5px;border-radius: 5px;text-align: center;line-height: 42px;background: #EDEDED;position: relative;}
.btn:before{position: absolute;content: '';border: 1px solid red;-webkit-border-radius: 10px;border-radius: 10px;left: -50%;top: -50%;right: -50%;bottom: -50%;-webkit-transform: scale(0.5);transform: scale(0.5);}