踩坑:移動端實現0.5px的方法

衆所周知在移動端寫1px邊框,顯示出來的效果看起來比較粗,而且在不同的移動設備顯示效果也千差萬別,那麼下面介紹一種常見的0.5px 的實現方法。

下面代碼可以實現4條邊框

 Container: {
    position: 'relative',
    width: '100%',
    height: theme.typography.pxToRem(666),
    padding: theme.typography.pxToRem(15),
    textAlign: 'center',
    borderRadius: 3,
    // border: '1px solid #F2F2F2',
    '&:before': {
      content: '""',
      display: 'block',
      position: 'absolute',
      left: '-50%',
      top: '-50%',
      width: '200%',
      height: '200%',
      border: '1px solid red',
      transform: 'scale(0.5)',
      borderRadius: 3
    }
  },

看看對比圖,在移動端效果很明顯:
在這裏插入圖片描述

在這裏插入圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章