Dead Center Div

DescriptionCSS snippet by - 09/25/10

Use these css rules to position a div dead center in the browser and keep it centered.

Tags ,

//The CSS

#horizon {position:absolute; top:50%; left:0px; width:100%; height:1px; overflow:visible;}

#content {position:absolute; top:-200px; left:50%; margin-left:-300px; width:600px; height:400px; background-color:#000;}

//The Html

<div id="horizon">
<div id="content">

</div>
</div>
  • Share
Authored by: Adam J Nowak
http://hyperspatial.com

Comments and Feedback