在可排序列表中对齐不同表的列

发布于 2024-11-01 22:16:56 字数 334 浏览 0 评论 0原文

我有一个可排序列表,每个可排序项目都包含一个表格。我想对齐所有表中的列。在CSS中使用table-layout:fixed效果很好,但是当单元格内容太长时,内容会重叠。我希望表格能够扩展以适合单元格中的内容,并且如果没有足够的水平空间,则应该出现水平滚动条。

我试图解决这个问题,将所有内容都放在一个表中,但这不好,因为在某些情况下,额外的内容会出现在排序项的表下,而且,使用 jquery 对表行进行排序也不能很好地工作。

代码的简化版本在这里: http://jsfiddle.net/buZUz/1/

I have a sortable list, each sortable item contains a table. I would like to align the columns from all the tables. Using table-layout: fixed in CSS works fine, but when the cell contents are too long, the contents overlaps. I would like the tables to expand to fit the content in the cells and horizontal scrollbar should appear if there's not enough horizontal space.

I tried to resolve this putting everything in one table, but this is not good, because in some cases extra content appears under the table in the sort item, and also, sorting table rows with jquery is not working so fine.

The simplified version of the code is here: http://jsfiddle.net/buZUz/1/

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦境 2024-11-08 22:16:56

我认为您在这里尝试使用多个表实现的目标将很难在不同的浏览器上实现和工作。我过去在 table-layout:fixed 方面遇到过很多“问题”,但现在从不使用它。

我很想回到一张表并使每一行都可排序。

要获取每行数据下的额外内容,您可以:

-add another row with a colspan that covers all of the rows and put you extra content in that.

-add hover event that shows the extra row or the data in a popup if it doesn't have to always be displayed.

-add the extra detail in a seperate table , "a detail table" that gets populated depending on which row is selected.

I think what you are trying to achieve here with multiple tables will be very difficult to achieve and make work accross different browsers. I have had a lot of "issues" in the past with table-layout:fixed and now never use it.

I'd be tempted to go back to one table and make each row sortable.

To get the extra content under the data in each row you could :

-add another row with a colspan that covers all of the rows and put you extra content in that.

-add hover event that shows the extra row or the data in a popup if it doesn't have to always be displayed.

-add the extra detail in a seperate table , "a detail table" that gets populated depending on which row is selected.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文