Skip to content

Instantly share code, notes, and snippets.

Created May 19, 2012 01:01
Show Gist options
  • Save anonymous/2728438 to your computer and use it in GitHub Desktop.
Save anonymous/2728438 to your computer and use it in GitHub Desktop.
Centering Test
/*
Centering Test
*/
.demo-1 .container {
position: relative;
width: 130px;
height: 130px;
padding: 0;
background: #b1b1b1;
}
.demo-1 img{
/* must set width + height in some way (px/%) */
max-width: 85%;
max-height: 85%;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
}
<div id="page" class="demo-1">
<div class="container">
<img src="http://lorempixel.com/700/300/sports/" />
</div>
</div>
{"view":"split-vertical","fontsize":"100","seethrough":"","prefixfree":"1","page":"all"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment