I have seen that while developing websites, vertically centering a container (of fixed height) inside a container of random height always comes as a nightmare for the web developer (at least, me) while when it comes to horizontal centering a container (of fixed width) inside a container of random width, the margin:0px auto; tends to serve an easy way out in the standard model.
When things can be as simple as that why doesn’t CSS work out with the margin:auto 0px; when it comes to centering a container of fixed height inside a container of random height? Is there any specific reason to do so?
It’s really less of a nightmare than you think, just don’t use margins.
vertical-alignis really what you should rely on for fluid-height vertical centering. I threw together a quick demo to demonstrate my point:See: http://jsfiddle.net/Wexcode/jLXMS/