Forum Moderators: not2easy

Message Too Old, No Replies

Absolute positioning in all resolutions

Is it possible?

         

Lorel

8:36 pm on Jun 9, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I have a menu floating over an image that is centered on the page. the menu is set with absolute positioning to be centered in the center of the image. Everything looks fine in 800x600 resolution but when I go to 1024x768 then the menu floats to the left because the page is wider.

Is there a way to position the menu so it is centered in all resolution or is there a way to set the positioning relative to the image? I tried putting the whole thing in a separate table but then the menu floats way over to the right (currently the main div for the menu is outside any table).

Or should I use a measurement that won't change with different resolutions? Is so, I'm not sure what that might be.

Here is the code I'm using to position the main menu:

#menu {
background-color: none;
width: 600px;
float:left;
position: absolute;
top: 150px;
left: 89px;
}

Lorel

DrDoc

8:43 pm on Jun 9, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You have two options:

#menu {
background-color: none;
width: 600px;
position: absolute;
top: 150px;
left: 50%;
margin-left: -300px;

}

#menu {
background-color: none;
width: 600px;
margin: 150px auto 0;
}

j4mes

8:49 pm on Jun 9, 2004 (gmt 0)

10+ Year Member



I'm currently employing the former and it works beautifully cross-browser.

Lorel

8:53 pm on Jun 9, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Wow! that works great. Thanks Dr. Doc.

Lorel