Div position center

26.Jul.2010

To position div in center of your HTML, you should set divs margin to auto. Use style from following snippet to position your div in center of html.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<head>
<style>
div.center {
	margin: 0 auto;
	width: 200px;
	height: 200px;
	background: #2abada;
}
</style>
</head>
<body>
	<div class="center">
	</div>
</body>