2 replies [Last post]
Dan the Man
Offline
newbie
Last seen: 18 years 38 weeks ago
Timezone: GMT+1
Joined: 2004-03-05
Posts: 3
Points: 0

I have a fixed width/height div containing the rest.

I want this to align "middle" vertically crossbrowser/platform and when resized. Have tried various settings for body, e.g. text-align middle, etc, but no go. I know there are JavaScripts available, but they're quite extensive (7-10Kb) so I like to avoid them.

Tips appreciated.

TIA
Dan

Dan the Man
Offline
newbie
Last seen: 18 years 38 weeks ago
Timezone: GMT+1
Joined: 2004-03-05
Posts: 3
Points: 0

Vertically aligned wrapping div. How?

Solved. Here's how I did:

The divs width/height is 750 x 430.
I placed it absolutely 50% left and 50% top.
Then margins HALF its width/height, i.e. left 375 and top 215 px.

Dan

josefk
Offline
newbie
london uk
Last seen: 18 years 38 weeks ago
london uk
Joined: 2004-03-09
Posts: 2
Points: 0

Vertically aligned wrapping div. How?

negative margins that is...

But I think Opera gets very confused... it doesn't know how to position top:50%, and so when the negative top margin is rendered, half your div disappears off the top.