Skip to content

Instantly share code, notes, and snippets.

@thure
Last active August 29, 2015 14:06
Show Gist options
  • Save thure/8f55abc5da46b025de5e to your computer and use it in GitHub Desktop.
Save thure/8f55abc5da46b025de5e to your computer and use it in GitHub Desktop.
<!doctype html>
<html>
<head>
<style>
body {
/* put the URL of the image you want to use in this rule: */
background-image: url('http://imgs.xkcd.com/comics/loop.png');
/* put the color you want to use for the negative space in this rule: */
background-color: #ccc;
/* no need to change anything else */
}
html, body {
height: 100%;
padding: 0;
margin: 0;
}
body {
background-position: top center;
background-size: auto;
background-repeat: no-repeat;
}
</style>
</head>
<body>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
body {
/* put the color you want to use for the negative space in this rule: */
background-color: #ccc;
}
html, body {
/* no need to change this rule */
height: 100%;
overflow: auto;
padding: 0;
margin: 0;
}
img {
/* no need to change this rule either */
display: block;
margin: 0 auto;
}
</style>
</head>
<body>
<!-- put the URL of the image you want to use in this rule: -->
<img src='http://imgs.xkcd.com/comics/loop.png'/>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment