user5332
user5332

Reputation: 774

CSS table td vertical-align text-top

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?

Upvotes: 25

Views: 98044

Answers (2)

Paket2001
Paket2001

Reputation: 450

It is also possible to set the attr style on your td

<td style="vertical-align: top;">

Upvotes: 5

Hafid Denguir
Hafid Denguir

Reputation: 952

Add this for div:

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

And this for input:

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

Upvotes: 38

Related Questions