Forum:Valign

I have many large and complex tables that I have spent years making.

These table make extensive use of valign and align which are now obsoete.

OK, well thats a pain but the world must progress so I suppose its all for the best.

I assumed that I would just have to look up the new equivalents of each of these obsolete elements and substitute them in.

But no. Its not that simple.

text-align:center evidently acts both horizontally and vertically.

what if I just want one or teh other?

And it only acts on inline elements!

margin:auto has the opposite problem.

It acts on block elemests but if I try to use it to center a child table in the center of a cell of a parent table then it only centers horizontally.

How do I center the table vertically?

Granpa (talk) 05:53, August 13, 2012 (UTC)
 * text-align only aligns horizontally.
 * margin:auto also aligns vertically. You'll have to apply it to the child table, of course.--PedroM (talk) 06:26, August 13, 2012 (UTC)


 * Text-align will only align horizontally and only on inline (or inline-block) elements as you noted; you need  to align a block element, or you can set it to   which will make it obey text-align. IIRC, all tables should, by default, align to the center vertically unless you override it.
 * The replacement for valign is.
 * Documentation is here: text-align vertical-align
 * BTW, the problem you had with  inside a table cell is probably because tables are extremely quirky in HTML (they are the most 'least like everything else' part due to legacy reasons),   won't work the way you expect inside a table cell because of the way cell padding works, it's just weird that way. Lunarity 07:32, August 13, 2012 (UTC)


 * Thanks for the quick responses guys. I am finally getting it to work though I really dont understand it at all.
 * funny thing though. If I use style="vertical-align: text-top;" for a table row then it should only effect inline elements
 * but tables within cells in that row also become vertically aligned to the top of the cell.
 * And whats the difference between  and  ?
 * Granpa (talk) 19:49, August 13, 2012 (UTC)
 * The latter is shorthand for .--PedroM (talk) 21:01, August 13, 2012 (UTC)