CSS Vertical alignment
- Started
- Last post
- 7 Responses
- doddster
does anyone know a decent way to centre a page vertically in the browser with CSS? Everyone I've asked seems to think its pretty buggy.
this is how I mean:
http://www.jonrichard.comThanks!
- doddster0
thanks for your links guys
determinedmoth - your link doesn't work with IE, if that matters to you!
- ornj0
Need to know the width and the height, The margins are negative one half of the respective dimention. Works in every browser so far except IE mac, but we've pretty much abandoned that browser for the most part.
div#Main {
position: absolute;
left: 50%;
top: 50%;
margin-left: -375px;
margin-top: -220px;
width: 750px;
height: 440px;
}
- doddster0
thanks ornj I'll give that a whirl...heres hoping I can convince the client to drop IE...
- weestu0
one more:
haven't tried it so dunno if it works, first link i posted seems to work pretty well...
- rafalski0
Good 'ol quirksmode tables didn't ask for neither content height nor width which was very usable.
Why w3c nerds were always against precise vertical centering/alignment was always beyond me. Even in html good people had to invent quirksmode, against w3c.xhtml quirksmode, where are you? :)