View Full Version : DIV Align Center AND 100px from the top....

05-16-2005, 05:00 AM
I am trying to get my stuff in the <DIV> tags to align to the center and center of the page. Like 500 right and 500 from top. However not everyone has a 1000 by 1000 window open, so I need it to align center from left and center from top. Any ideas, comments, or suggestions, would greatly be apreciated. Thanks.


05-16-2005, 05:11 AM
see if this does anything for you:

<style type="text/css">
body, html {height: 100%; text-align: center; overflow: hidden;}
#outer {height: 100%; overflow: visible; margin: auto auto; position: relative; }
#outer[id] {display: table; position: static;}
#middle {position: absolute; top: 50%;}
#middle[id] {display: table-cell; vertical-align: middle; position: static;}
#inner {position: relative; top: -50%; left: -50%}
#inner[id] {position: static;}
#box {border: 1px solid #ccc; padding: 6px; position: relative; text-align: center;}
<div id="outer">
<div id="middle">
<div id="inner">
<div id="box">

<p>middle &amp; center</p>

05-16-2005, 05:18 AM
That works, but any way to get it NOT tide in with the HTML page? I need a stand alone DIV Style. I can't have all the text on the page centered, etc. Just this DIV box. Thanks for your time.


05-16-2005, 05:53 AM
you wouldnt happen to have a pge up that we could look at do you?

are you trying to get the centered box to hover in the center over everything else?