Skip to content

Instantly share code, notes, and snippets.

@KiligFei
Created March 17, 2021 08:56
Show Gist options
  • Save KiligFei/2b338f0b496c4abba77c979687e1aeaf to your computer and use it in GitHub Desktop.
Save KiligFei/2b338f0b496c4abba77c979687e1aeaf to your computer and use it in GitHub Desktop.
[手机端 1px 的线] # CSS
.box:before{
    content: "";
    pointer-events: none; /* 防止点击触发 */
    box-sizing: border-box;
    position: absolute;
    width: 200%;
    height: 200%;
    left: 0;
    top: 0;
    border:1px solid #000;
    -webkit-transform(scale(0.5));
    -webkit-transform-origin: 0 0;
    transform(scale(0.5));
    transform-origin: 0 0;
}

也可根据 CSS media querydevicePixelRatio 来设置线条的像素,devicePixelRatio=2 时设置 0.5pxdevicePixelRatio=3 时设置 0.333333 px,但是这个方法完全不适用安卓

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment