Skip to content

Instantly share code, notes, and snippets.

@TheDahv
Created May 18, 2011 16:40
Show Gist options
  • Save TheDahv/978963 to your computer and use it in GitHub Desktop.
Save TheDahv/978963 to your computer and use it in GitHub Desktop.
Scalable background image on a site
<html>
<head>
<title>Scalable Image Test</title>
<style type="text/css">
body {
/* Background image rules */
background-attachment: fixed;
background-color: #333;
background-image: url(../img/bgimg.png);
background-position: top right;
background-repeat: no-repeat;
margin: 0;
padding: 0;
background-size: 30% auto;
-moz-background-size: 30% auto;
-webkit-background-size: 30% auto;
}
body {
text-align: center;
}
section {
margin: 0 auto;
}
</style>
</head>
<body>
<h1>Scalable Image Test</h1>
<section>
<p>Hi. This is where we are going to test scalable background images</p>
</section>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment