Skip to content

Instantly share code, notes, and snippets.

@d13
Last active October 15, 2015 03:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save d13/a2574d7187e8139a8a36 to your computer and use it in GitHub Desktop.
Save d13/a2574d7187e8139a8a36 to your computer and use it in GitHub Desktop.
retina media-query
.m-mq(@query, @ruleset) {
@media @query {
@ruleset();
}
};
.m-mq-retina(@ruleset) {
@query: ~"only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (min--moz-device-pixel-ratio: 1.5), only screen and (-o-min-device-pixel-ratio: 3/2), only screen and (min-device-pixel-ratio: 1.5), only screen and (min-resolution: 192dpi)";
.m-mq(@query, @ruleset);
};
.icon-foo {
width: 30px;
height: 30px;
background: url(../images/icon-foo.png) no-repeat center center;
.m-mq-retina({
background-image: url(../images/icon-foo-@2.png);
background-size: 30px 30px;
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment