steveosoule
8/2/2013 - 9:00 PM

Vertically Center Element

Vertically Center Element

<!-- http://html5hub.com/centering-all-the-directions/ -->
<style>
  #ex3_container {
		width:200px;
		height:200px;
		background-color:yellow;
		position:relative;
	}
	#ex3_content {
		left:50%;
		top:50%;
		transform:translate(-50%,-50%);
		-webkit-transform:translate(-50%,-50%);
		background-color:gray;
		color:white;
		position:absolute;
	}
</style>

<div id="ex3_container">
	<div id="ex3_content">Hello World</div>
</div>