We would like to know how to center div inside another div.
<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
#bg {<!-- w w w. java 2 s . c om-->
background-color: red;
}
#content {
margin-left: auto;
margin-right: auto;
position: relative;
left: 0px;
top: 0px;
width: 200px;
background-color: #EEE;
}
</style>
</head>
<body>
<div id="bg">
<div id="content">Here is my content.</div>
</div>
</body>
</html>
The code above is rendered as follows: