quote:
Originally posted by Sunshine
Yeah ok Leejeffy i knew that, but how do you get divs starting at a certain place without having to absolute position it...and so it will look same on all screen resolutions (autoadjusting div width)?
<style>
#randomdiv {
position: absolute;
left: 50%;
margin-left: -100px; // Half of what you want the width to be
top: 50%;
margin-top: -100px; // Half of what you want the height to be
width: 200px;
height: 200px;
}
</style>
<div id="randomdiv">This text is in a centered box 200x200 pixels big</div>
Got the trick from TheGeek, thank him.
There is one more possibly easier way to do it:
<style>
body {
margin: 0px auto;
width: 100%;
height: 100%;
}
#randomdiv {
margin 0px auto;
width: 200px;
height: 200px;
}
</style>
Also, if you want something to be positioned around that, just center it at 50% and set the leftmargin to how far away it should be from the center