移动端一像素方案

以vue中使用stylus为例

mixin.stylus

border-1px($color)
  position : relative
  &:after
    display: block
    position: absolute
    left: 0
    bottom: 0
    border-top 1px solid $color
    width: 100%
    content: ''

border-none()
  &:after
    display: none

同样的,在需要写1像素边框的地方引入这段代码,使用的时候直接用border-1px(yourColor)就可以了,
不需要的时候用border-none()就可以了。


你可能感兴趣的:(移动端一像素方案)