Forum Moderators: not2easy

Message Too Old, No Replies

Absolute position offset from center

can this be done?

         

moltar

8:13 pm on Sep 6, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



My whole website is inside one set width table and centered. I want to place something to the right of the table, but remaining the table to be centered.

I figured I could use absolute positioning in CSS. But everybody's screens are different and I can't predict where it's going to end up. So I am wondering if it's possible to specify an offset from center in pixels?

Nick_W

8:14 pm on Sep 6, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You'd need to use JS I think..

Nick

moltar

8:27 pm on Sep 6, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You mean I need to determine screen size and then position accordingly?

Nick_W

8:54 pm on Sep 6, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think so, yes.

Nick

SuzyUK

9:26 pm on Sep 6, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



if you specify the position of your table relatively (still can be centered) then you could possibly position another element absolutely, but still in relation to the table.. need to run some tests

do you know the width of the table?

Suzy

moltar

10:25 pm on Sep 6, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



How do I center the table relatively?

Yes I know the exact width of the table.

TGecho

1:04 am on Sep 7, 2003 (gmt 0)

10+ Year Member



left : 50%; /* puts left edge in the middle */
margin-left : 300px; /* change to equal half the length of your centered table */

moltar

1:49 am on Sep 7, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



cool! thank you :)

Purple Martin

3:13 am on Sep 8, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Shouldn't that be a negative margin-left? Like this:

left : 50%; /* puts left edge in the middle */
margin-left : -300px; /* change to equal half the length of your centered table */

Also, you can absolutely position something a set distance from the right edge of the screen like this:

right: 120px; /* other units like percents work as well */

TGecho

3:26 am on Sep 8, 2003 (gmt 0)

10+ Year Member



Sorry, I was answering his original question.

Yes, make it negative to center the original table. Make it positive to put an element to the right of the centered table. Make it positive and add the width of the element you're placing to put it to the left. Was that confusing enough? :)
I really need to work on explaining things...