表格宽度对于页面来说太宽 - jQuery?

发布于 2024-12-29 02:33:29 字数 386 浏览 1 评论 0原文

我有一个 HTML 表格,在一行中显示很多列 (~25),并且该表格超出了页面的大小并导致滚动条。这是预期但不受欢迎的行为。

我正在寻找一种方法来缩小每列的内容,并在需要时将列拉伸得更大。

所以目前我表中的一行看起来像这样:

information1 |信息2 |信息3 |信息4 | information5

所需的功能将是这样的:

infor... | information5信息... |信息... |信息... |信息...

每一列都可以拉伸或悬停在上面等...以查看完整内容。我见过一些 jQuery 插件,如 zentable 和 ingrid,它们允许调整列大小,但不允许串联,据我所知,可以在没有滚动条的情况下适应父元素中表格的所有内容。

I have an HTML table displaying a lot of columns in a single row (~25) and the table is stretching way beyond the size of the page and causing scrollbars. This is expected but undesirable behaviour.

I am looking for a way to shrink the content of each column with a way of stretching the columns larger if needed.

So currently a row in my table would look something like this:

information1 | information2 | information3 | information4 | information5

Desired functionality would be something like this:

infor... | infor... | infor... | infor... | infor...

With each of those columns the ability to be stretched out or hovered over etc... to see the full content. I have seen a few jQuery plugins like zentable and ingrid which allow the column resizing but not the concatenation as far as I know to fit all the content of the table in the parent element without scrollbars.

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

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

发布评论

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

评论(1

小耗子 2025-01-05 02:33:29

您在寻找省略号吗?这就是文本被截断并后面加点的时候……

如果文本溢出容器,请添加省略号:

overflow: hidden;
text-overflow: ellipsis;
-o-text-overflow: ellipsis;
white-space: nowrap;
width: 100%;

这个人提供了更多相关细节。

Are you looking for ellipsis? That's when the text is truncated and followed by dots......

Add ellipsis if the text overflows the container:

overflow: hidden;
text-overflow: ellipsis;
-o-text-overflow: ellipsis;
white-space: nowrap;
width: 100%;

This fellow provides more detail about it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文