Git Product home page Git Product logo

postcss-retina-border's Introduction

postcss-retina-border

该postcss插件处理1pxborder问题。

该插件将检查border属性,如果包含1px1PX设置,将添加DPR 媒体查询0.5PX的border设置,使retina显示更细的border。

该方式无法兼容android、 ios8以下设备。如果安卓机的DPR大于2,将会不显示border

转换例子

.border{
    display: block;
    width: 100px;
    height: 100px;
    border: 1px solid #333;
}

转换为:

.border {
    display: block;
    width: 100px;
    height: 100px;
    border: 1px solid #333;
}
@media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min--moz-device-pixel-ratio: 2), only screen and (min-resolution: 2dppx), only screen and (min-resolution: 192dpi)
{
    .border {
        border: 0.5PX solid #333;
    }
}

混合border设置

.border {
    border: 1px solid #333;
    border-bottom: 0;
    border-left-width: 2px;
}

转换为:

.border {
    border: 1px solid #333;
    border-bottom: 0;
    border-left-width: 2px;
}
@media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min--moz-device-pixel-ratio: 2), only screen and (min-resolution: 2dppx), only screen and (min-resolution: 192dpi)
{
    .border {
        border: 0.5PX solid #333;
        border-bottom: 0;
        border-left-width: 2px;
    }
}

使用

安装

npm i --save-dev postcss-retina-border

使用

参考

postcss-retina-border's People

Contributors

lovekonakona avatar

Stargazers

Mayke avatar

Watchers

 avatar James Cloos avatar yangxin avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.