Skip to content

Instantly share code, notes, and snippets.

@JosephSilber
Created February 23, 2012 19:46
Show Gist options
  • Save JosephSilber/1894689 to your computer and use it in GitHub Desktop.
Save JosephSilber/1894689 to your computer and use it in GitHub Desktop.
Center wide image
/* Center wide image */
html, body, #container {
height: 100%;
}
#container {
width: 200px;
margin: 0 auto;
background: #ffd2be;
}
img {
position: relative;
left: -28px; /* (256 - 200) / 2 */
}
<div id="container">
<img src="http://cdnx.dev4press.com/wp-content/themes/lightscape/products/icons/gd-affiliate-center_256.png" />
</div>
{"view":"split-vertical","seethrough":"","prefixfree":"1","page":"css"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment