繁体   English   中英

具有动态宽度单元格的固定表

[英]fixed table with dynamic width cell

我已经为此工作了好几天,但找不到任何解决方案!

我有一个正在页面中使用的表格,我既不能指定table-layout又不能使其中一个单元格具有动态宽度,但是,不能指定“空白”或“溢出”。 如果我设置“ table-layout:fixed”,则动态单元格宽度会消失,但是我可以指定“ white-space”和“ overflow”。

我都需要! 如何仅使用CSS完成此操作? (为Jukka添加了粗体)

 <table style="width: 50%;"> <tr> <td style="width: 20px;">1</td> <td style='overflow: hidden; white-space: nowrap;'> here is a really long string to hide </td> <td style='width: 20px;'>3</td> </tr> </table> 

<table style="width: 50%;">
<tbody><tr>
   <td style="width: 20px;">1</td>
   <td style="overflow: hidden;height:20px;display: block;">
       here is a really long string fdfddddddddddddddddddddddddddddddddddddddddddddddddddddddfdfd fdf df dfdfddddddddddddddddddddddddddddddddddddddddddddddddddddddddd fdfd fdfdto hide
   </td>
   <td style="width: 20px;">3</td>
</tr>
</tbody></table>

display:block + height:20px应该有帮助:-)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM