1px邊框在pc端中就是實打實的1px,那麼在移動端呢?跟devicePixelRatio值有關,devicePixelRatio值爲多少,實際1px在移動端就要用1px*devicePixelRatio,那麼這種狀況該如何解決呢?web
HTML:orm
<div class="btn">我是按鈕</div>it
CSS:io
.btn{margin: 50px auto;width: 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);}form