且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

设置表格单元格内容的最大高度

更新时间:2023-01-13 19:15:07

我们终于找到了一个答案。首先,问题:表始终围绕内容大小自身,而不是强制内容适合表中。这限制了您的选择。

We finally found an answer of sorts. First, the problem: the table always sizes itself around the content, rather than forcing the content to fit in the table. That limits your options.

我们通过设置content div来显示:none,让表格大小本身,然后在javascript设置的高度和宽度内容div到封闭td标签的内部高度和宽度。显示内容div。在调整窗口大小时重复此过程。

We did it by setting the content div to display:none, letting the table size itself, and then in javascript setting the height and width of the content div to the inner height and width of the enclosing td tag. Show the content div. Repeat the process when the window is resized.