100%宽度的表格溢出div容器 [英] 100% width table overflowing div container
本文介绍了100%宽度的表格溢出div容器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我遇到了溢出它的父容器的html表格问题。我已经在这里设置了示例jsfiddle 来说明问题。
如何强制标题文本和表格单元格文本以适合其容器的方式进行包装?我更喜欢CSS方法,但如果绝对必要的话,也可以使用Javascript(或jQuery)。
解决方案
从纯粹的让它适合div ,请将以下内容添加到您的表格类中( jsfiddle ):
table-layout:fixed;
宽度:100%;
I am having issues with an html table that is overflowing it's parent container. I have setup a sample jsfiddle here to illustrate the problem.
How can I force both the header text and the table cell text to wrap in a way that it will fit in its container properly? I would prefer a CSS only method but am also open to using Javascript (or jQuery) if absolutely necessary.
解决方案
From a purely "make it fit in the div" perspective, add the following to your table class (jsfiddle):
table-layout:fixed;
width: 100%;
See fixed versus automatic table layout.
这篇关于100%宽度的表格溢出div容器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文