center my page

yvonne

New Member
im sorry,on different kind of monitors i want to auto adjust it!
because if i know good,most of the monitors are 1024x768 but still,i want the page to auto adjust to any size of the monitor,can i do that?
thanks dave :)
 

PixelPusher

Super Moderator
Staff member
If you are going to stick with using absolute positioning, you can do something like this:
Code:
div#Layer5 {
    position: absolute;
    left:50%;
    z-index: 2;
    margin:14px 0 0 -400px;
    width: 800px;
    height: 56px;
}

What you are doing is setting the left property to 50% which will put the left edge of the element in the middle of the page every time, no matter what the resolution. But we want the center of the element in the center so you need to offset the left margin with a negative value. This value needs to be half the width of the element.
 

PixelPusher

Super Moderator
Staff member
Few comments:

Use external style sheets. Don't write inline styles for all your elements.
Find a common width for the main page divs. Some of yours are 783, 782, 779, etc.
 
Top