gpt4 book ai didi

css - Nowrap table heading 如果有空间,但如果这会破坏布局

转载 作者:行者123 更新时间:2023-11-28 08:51:34 25 4
gpt4 key购买 nike

我有一张 table 。我希望标题文本不换行,我可以使用 white-space nowrap 来做到这一点。

但是我的布局是响应式的。在宽度较小的情况下,此 nowrap 将破坏布局,使表格比其容器宽。

当有足够的空间时,如何使表格标题不换行,但不换行会使表格比其容器宽。

enter image description here

最佳答案

您可以为此使用简单的媒体查询:

// Mobile only
@media screen and (max-width: 599px) {
// Wrap
}

// Everything else
@media screen and (min-width: 600px) {
// No wrap
}

关于css - Nowrap table heading 如果有空间,但如果这会破坏布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27315935/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com