Skip to content

Instantly share code, notes, and snippets.

@fregante
Created August 17, 2012 14:51
Show Gist options
  • Save fregante/3379426 to your computer and use it in GitHub Desktop.
Save fregante/3379426 to your computer and use it in GitHub Desktop.
Switch CSS background instead of resizing it. With media queries
html{
background: url(res/bg/1280.jpg) fixed center black;
}
@media only screen and (min-width:1281px),
only screen and (min-height:801px) {
html{ background-image: url(res/bg/1366.jpg); }
}
@media only screen and (min-width:1367px),
only screen and (min-height:855px) {
html{ background-image: url(res/bg/1440.jpg); }
}
@media only screen and (min-width:1441px),
only screen and (min-height:901px) {
html{ background-image: url(res/bg/1680.jpg); }
}
@media only screen and (min-width:1681px),
only screen and (min-height:1051px) {
html{ background-image: url(res/bg/1920.jpg); }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment