Skip to content

Instantly share code, notes, and snippets.

Created May 18, 2012 21:47
Show Gist options
  • Save anonymous/2727775 to your computer and use it in GitHub Desktop.
Save anonymous/2727775 to your computer and use it in GitHub Desktop.
Untitled
.container {
width: 500px;
height: 500px;
background: #b1b1b1;
margin: 0 auto;
}
.demo-1.container {
position: relative;
}
.demo-1 .center {
position: absolute;
top:0;
left:0;
right:0;
bottom:0;
margin: auto;
}
.ts-demo.container {
display: table;
}
.ts-demo .center {
display: table-cell;
vertical-align: middle;
text-align: center;
/* display: inline-block; -- IE7 fallback */
}
<div class="container ts-demo">
<div class="center">
<img src="http://lorempixel.com/200/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