Not sure why but for the life of me I cannot get my text to align on the top of a table cell (td) when the cell before it is wrapping text.
If I write it out in the HTML it works, but unable to get the same effect in my CSS.
Works with HTML:
<td style="vertical-align:text-top;">Some Text</td>
Doesn't with CSS:
table td { vertical-align: text-top; }
And I have tried every combination you can think of within my CSS
Make sure you are not setting "display: block" on the TD elements, as vertical align doesn't work on block elements. Also, text-top is not the best, and has some cross browser issues. Use "top" instead. Try adding this in your stylesheet:
table td {
display: table-cell;
vertical-align: top;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.