how to bring a div to center of page code example
Example 1: center div in middle of page
.centered {
position: fixed;
top: 50%;
left: 50%;
/* bring your own prefixes */
transform: translate(-50%, -50%);
}
Example 2: how to put container in center of page
#container
{
width: 400px;
margin-left: auto;
margin-right: auto;
}
Example 3: center a div
<div id="outer">
<div id="inner">Foo foo</div>
</div>
//css:, demo with border
<style>
#inner {
display: table;
margin: 0 auto;
border: 1px solid black;
}
#outer {
border: 1px solid red;
width:100%
}
</style>
Example 4: how to put container in center of page
div.InSkinAlignCenter {
margin: 0 auto;
}