HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Positioning backgrounds</title>
<style>
body {
font: 14px courier;
background: #fff;
color: #000;
margin: 0;
padding: 10px;
}
p {
background: #ccc url("/examples/images/opacityBg.gif") no-repeat;
height: 200px;
text-align: center;
margin: 20px;
}
code {
background: white;
padding: 0 15px 2px;
}
#p0 {
background: none;
height: auto;
}
#p1 {
background-position: center;
}
#p2 {
background-position: right;
}
#p3 {
background-position: bottom left;
}
#p4 {
background-position: 20px;
}
#p5 {
background-position: 50%;
}
#p6 {
background-position: 75% 25px;
}
#p7 {
background-position: top 99px right 9px;
}
#borderCollie {
background: none;
}
#borderCollie a {
display: block;
height: 200px;
background: #ccc url("http://www.htmldog.com//badge1.gif") center no-repeat;
transition: background-position .5s;
text-indent: -999em;
}
#borderCollie a:hover {
background-position: 50% 10px;
}
</style>
</head>
<body>
<p id="p0">In addition to <code>background-repeat: no-repeat</code>…</p>
<p id="p1"><code>background-position: center;</code></p>
<p id="p2"><code>background-position: right;</code></p>
<p id="p3"><code>background-position: bottom left;</code></p>
<p id="p4"><code>background-position: 20px;</code></p>
<p id="p5"><code>background-position: 50%;</code></p>
<p id="p6"><code>background-position: 75% 25px;</code></p>
<p id="p7"><code>background-position: top 99px right 9px;</code></p>
<!-- Link back to HTML Dog: -->
<p class="pbp" id="borderCollie"><a href="http://www.htmldog.com/examples/"><img src="http://www.htmldog.com/badge1.gif" alt="HTML Dog"></a></p>
</body>
</html>