2

I working on a locked headers jquery plugin and i am running into a problem where a table width is smaller than the sum of the column widths.

Here is how locked header plugins work: You create another table containing your table's original header and put it into a table thats floated above the original table. You then make sure the floated table's column widths and the original table's column widths are equal.

I am running into a problem where if a table has a width of 100% and its inside of a container with overflow, it seems that the table's width is not controlled by the sum of its column widths.

if the table is not in a container, it works.

see this test case: http://programmingdrunk.com/floatThead/examples/big-table.htm

the first table should be as wide as the floated header. you can see that the column widths do not match up.

the 2nd table works fine because its not within a container with overflow:auto;

4

1 回答 1

0

您正在使用表格布局:已修复。只是阅读它,似乎有了这个,表格的第一行用于计算表格的宽度。当我检查时,您的第一行似乎是空的,这可能是导致问题的原因吗?

没有任何内容,这个宽度将等于容器的 100%,基于你的 css,这似乎是正在发生的事情。

尝试更改为table-layout: auto,尽管我怀疑您可能依赖于当前样式。

于 2012-11-05T17:00:15.347 回答