CSS如何使< TD>固定高度? [英] CSS how to make <TD> a fixed height?

查看:463
本文介绍了CSS如何使< TD>固定高度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<table  cellspacing="0" id="contactTable" style="table-layout:table-layout:fixed;; width:100%; font-weight:normal; position: absolute; top:45; left: 0;">

<td height="50" style="padding-left:5px; overflow:hidden; ">
    <span style="text-transform:capitalize;line-height:100%;">
    //names here
    </span>                          
    </td>

...more code
</table>

这不起作用。

推荐答案

最好的解决方案是在单元格中放置一个div与高度:

The best solution is to put a div inside the cell with the height:

<td style="padding-left:5px;">
  <div style="height: 50px; overflow:hidden;">
      ...
  </div>
</td>

BTW,如果您只需要使用样式,则可以直接为单元格设置样式。

BTW, what is the span for? If you only need it for styling, you can style the cell directly instead.

这篇关于CSS如何使&lt; TD&gt;固定高度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆