Skip to content

Instantly share code, notes, and snippets.

@wvteijlingen
Created August 25, 2015 15:15
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 wvteijlingen/4b72d6d7e4f56d212c19 to your computer and use it in GitHub Desktop.
Save wvteijlingen/4b72d6d7e4f56d212c19 to your computer and use it in GitHub Desktop.
retina-background(url, width, height)
dir = dirname(url)
ext = extname(url)
base = basename(url, ext)
background-image: url(dir '/' base ext)
@media (-webkit-min-device-pixel-ratio: 2),
(min--moz-device-pixel-ratio: 2),
(-o-min-device-pixel-ratio: 2/1),
(min-device-pixel-ratio: 2),
(min-resolution: 192dpi),
(min-resolution: 2dppx)
background-image: url(dir '/' base '@2x' ext)
if width && height
background-size: width height
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment