There are two main options for vertically centering an element of unknown height with CSS, neither of which work in IE7 (using a pseudo-element, or using display: table. See here for more information: http://css-tricks.com/centering-in-the-unknown/). Your best bet would be to use JavaScript. Here is a jQuery solution, although someone that can do it in JavaScript should be able to come up with something better: http://jsfiddle.net/joshnh/zGw9s/
@ChristopherBurton margin: 0 auto; is for horizontal centering, I'm interested in both vertical and horizontal centering.The above mentioned method works with the major browsers, but fails in ie7.Of course it works only with widthless, hightless images and probably tables to(their heights are calculated), but not with widthless-hightless p, div tags.
@joshuanhibbert Thank you, so I need to set an alternative method for ie7.
margin: 0 auto; is for horizontal centering, I'm interested in both vertical and horizontal centering.The above mentioned method works with the major browsers, but fails in ie7.Of course it works only with widthless, hightless images and probably tables to(their heights are calculated), but not with widthless-hightless p, div tags.
@joshuanhibbert
Thank you, so I need to set an alternative method for ie7.