CSS table td vertical-align text-top

user5332 picture user5332 · Apr 13, 2013 · Viewed 74.2k times · Source

I have problem with vertical-align to text-top on tables

I have globally set at table td to vertical-align: middle.

Now I need to change only one td to vertical-align: text-top

The problem is, that all variant that I tested set vertical-align:text-top are shown as top only

("xxxx" in image is not at same line as "yyyy")

Only one variant is working as text-top, and that is change globally style of all td (I don't want this, I need to change only one td)

SEE IMAGES

Setting as local style is shown as top local style http://aukro.svecpetr.com/style.png

Setting as class is shown as top local style http://aukro.svecpetr.com/class.png

Changing global td has the right effect of text-top local style http://aukro.svecpetr.com/global-style.png

EXAMPLE you could find at https://zbozimat.cz/test.php

Could somebody help me?

Answer

hafid2com picture hafid2com · Apr 13, 2013

Add this for div:

display: inline-block;
vertical-align: top;

And this for input:

display: inline-block;
vertical-align: top;