Centering a DIV using CSS
#content { width: 700px ; margin-left: auto ; margin-right: auto ;}
But how do you center a DIV in the center within a DIV? Say I have two absolute div and one is within the other. Both has got position set to absolute. We can do this:
<div style="width:900px;position:absolute;margin-left:-450pxtop:50px;left:50%;">
position:absolute will set the position to absolute
left:50% will set the child div to be drawn in the center
margin-left:450px will dictate that the drawn child be drawn to left by 450
No comments:
Post a Comment