启用溢出:滚动到 100% 宽度的表格单元格
我正在尝试执行以下操作: http://www.pastebin.org/113337
我'我想知道为什么滚动不会发生?它只是拉伸桌子。尝试运行带有和不带有空格的代码:nowrap 并查看其有何不同。每当我应用 nowrap 时,我的桌子就会被拉长。我该如何避免这种情况?
I'm trying to do the following: http://www.pastebin.org/113337
I'm wondering why the scrolling won't take place? It just stretches the table. Try running the code with and without white-space: nowrap and see how it differs. Whenever I apply nowrap my table gets stretched. How do I avoid this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我很确定这就是表格的工作原理;当其中一个单元格中有太多内容时,它们就会伸展。
尝试将
放入
中,然后对其应用宽度和溢出属性。
附录:
您的
table
的 CSS 宽度属性为150px
,而div
的 CSS 宽度属性为%100
。尝试为指定非百分比宽度...
或者尝试将整个
放入
> 具有固定宽度...
...最后,我建议您将 CSS 放入外部
.css
文件中;)I'm pretty sure that's just how tables work; they stretch when there's too much content in one of their cells.
Try putting a
<div>
inside your<td>
and apply the width and overflow properties to that instead.Addendum:
Your
table
has a CSS width property of150px
while thediv
has a percentage,%100
. Try giving the<div>
a non-percentage width...Or try putting the whole
<table>
in a<div>
with a fixed width...... lastly, I'd advise that you put your CSS in an external
.css
file ;)