HTML CSS如何阻止表单元格展开 [英] HTML CSS How to stop a table cell from expanding

查看:119
本文介绍了HTML CSS如何阻止表单元格展开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个表,它是用来自返回的数据集的内容构建的。我想做的是停止'描述'单元格扩展超过280px宽,无论内容长度(它的字符串)。我尝试过:

I have a table which is built with the contents coming from a returned dataset. What I want to do is stop a 'description' cell from expanding over 280px wide, no matter what the content length (its s string). I have tried:

<td align="left" valign="top" style="overflow:hidden;" nowrap="nowrap" width="280px" >

但这似乎不工作。

推荐答案

看起来你的HTML文件语法对于表单元格不正确。在你尝试下面的其他想法之前,请确认这是否工作...你也可以尝试添加到你的表本身:table-layout:fixed ..。

It appears that your HTML syntax is incorrect for the table cell. Before you try the other idea below, confirm if this works or not... You can also try adding this to your table itself: table-layout:fixed.. .

<td style="overflow: hidden; width: 280px; text-align: left; valign: top; whitespace: nowrap;">
   [content]
</td>

新HTML

<td>
   <div class="MyClass"">
       [content]
   </div>
</td>

CSS类别

.MyClass{
   height: 280px; 
   width: 456px; 
   overflow: hidden;
   white-space: nowrap;
}

这篇关于HTML CSS如何阻止表单元格展开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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