Nested retina media queries with Sass

1 Comment

  1. Nour Akalay

    Hello,

    I think the function could be made more reusable by rewriting it to accept any size instead of only pre-defined ones.
    I\’m new to sass so I hope I didn\’t make any mistake in the following rewrite of your function

    @mixin mq($mq) {
    @if $mq == retina {
    @media
    only screen and (-webkit-min-device-pixel-ratio: 2),
    only screen and ( min–moz-device-pixel-ratio: 2),
    only screen and ( -o-min-device-pixel-ratio: 2/1),
    only screen and ( min-device-pixel-ratio: 2),
    only screen and ( min-resolution: 192dpi),
    only screen and ( min-resolution: 2dppx) {
    @content;
    }
    } @else {
    @media (max-width: $mqpx) { @content; }
    }
    }

Leave a Reply

Your email address will not be published. Required fields are marked *