Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vertical-align not working inside of td

Tags:

html

css

I am trying to vertically align my div (which is inside of a td) to be at the top, but vertical-align: top is not working. Here is the fiddle:

http://jsfiddle.net/hreDw/1/ (I want that yellow b to be at the top)

How can I do this? Also, amount of a's inside of the second td is dynamic - so the height of the table is also dynamic.

like image 321
ojek Avatar asked Dec 05 '25 03:12

ojek


1 Answers

The vertical-align CSS property specifies the vertical alignment of an inline or table-cell box.

Read more about vertical-align

Therefore, you have to apply the vertical-align property to the td element:

.first {
    background-color:black;
    min-height: 10px;
    min-width: 10px;
    vertical-align: top;
}
.first div {
    background-color:yellow;
}
.second {
    background-color:green;
    min-height: 10px;
    width: 10px;
}
like image 188
rink.attendant.6 Avatar answered Dec 06 '25 19:12

rink.attendant.6



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!