移動端1px 邊框

僞類+ transform
.border_1px:before{
          content: '';
          position: absolute;
          top: 0;
          height: 1px;
          width: 100%;
          background-color: #000;
          transform-origin: 50% 0%;
        }
        @media only screen and (-webkit-min-device-pixel-ratio:2){
            .border_1px:before{
                transform: scaleY(0.5);
            }
        }
        @media only screen and (-webkit-min-device-pixel-ratio:3){
            .border_1px:before{
                transform: scaleY(0.33);
            }
        }

設備像素比device pixel ratio簡稱dpr,即物理像素和設備獨立像素的比值。
scaleY(y) 經過設置 Y 軸的值來定義縮放轉換。web

相關文章
相關標籤/搜索