开发者

CSS: min-height and vertical-align:middle

How to force min-hei开发者_JAVA技巧ght and vertical-align:middle to work for td element or it's inner element?


The height on a td element is the equivalent of min-height, as a table cell will always stretch if required - but note that, especially in a complex table, that setting heights on table rows is a tricky, often impossible, process, browsers have a great deal of leeway in how they render tables and will often make a "judgement call"

td {
 height: 100px;
 vertical-align:middle;
}


You can always put a div inside the td and put the css rules in the div...


margin: *;

Might do the job...


To force min-height attribute for td you also can put invisible image in td, or wrap you td into div. Example for first case:

<td><img style="float:left;min-height:50px;visibility:hidden;width:0px;">12345</td>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜