views:

30

answers:

1

I am looking without much luck how to center an element (a table) vertically. I tried CSS vertical-align: middle; which did not work I also tried margin-top: auto; margin-bottom: auto; which also did not work. I also used the table attribute valign as "middle" which still did not work. I am using Chrome but have tested all these strategies in IE as well with the same results.

+1  A: 

Here is a page which shows a technique to accomplish this and a how to use it in a couple different scenarios. This method has one issue since it relies on you knowing the height of the element you want to vertically center. If you don't know that then this will not work for you.

Matthew Manela
Thats a good solution and you could always just force a height I suppose
Alan