Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS table td vertical-align text-top

Tags:

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?

like image 964
user5332 Avatar asked Apr 13 '13 12:04

user5332


People also ask

How do I align text on top of a table?

To place an item at the top or bottom of its cell, insert the "VALIGN=" attribute within the code for that cell. To vertically align an entire row (e.g., placing all data in that row at the tops of the cells), insert the "VALIGN=" attribute within the code for that row.

How do I vertically align text in a div using CSS?

The CSS just sizes the div, vertically center aligns the span by setting the div's line-height equal to its height, and makes the span an inline-block with vertical-align: middle. Then it sets the line-height back to normal for the span, so its contents will flow naturally inside the block.


1 Answers

Add this for div:

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

And this for input:

display: inline-block; vertical-align: top; 
like image 84
Hafid Denguir Avatar answered Nov 24 '22 00:11

Hafid Denguir