html - 如何在垂直表(转置表)中自动换行标题?

标签 html css responsive-design

我们正在使用这里描述的响应表:http://dbushell.com/demos/tables/rt_05-01-12.html .

enter image description here

它通过创建一个带有固定左列的垂直表格来转置表格。转置的标题行, 然而,它并没有包裹在空白处,并且不必要地加宽了表格。

For transposing, the trick is to use display: inline-block; on the table rows and white-space: nowrap; on the table body.

在标题行中启用换行的任何解决方案?

JsFiddle 链接:http://jsfiddle.net/ckaodhz1/

上述技巧的代码:

table thead { display: block; float: left; }
table tbody {
    display: block;
    width: auto;
    position: relative;
    overflow-x: auto;
    white-space: nowrap;
}
table thead tr { display: block; }
table th { display: block; }
table tbody tr { display: inline-block; vertical-align: top; }

最佳答案

您可以使用 <th>所有 header 的标记。

然后你可以使用word-wrap: break-word;对于 <th>标签。

关于html - 如何在垂直表(转置表)中自动换行标题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29797746/

相关文章:

css 媒体查询 : conflict between desktop and newest smartphones resolutions

javascript - 如何使用 JavaScript(不是 jQuery)隐藏工具提示

javascript - 使用 Javascript/Jquery 用图像替换单词

css - 多色单个图标

css - 响应式 3 列页面最后一列在非常窄的窗口时跳转

html - 如何在 bootstrap 4 中的响应图像内制作响应框?

android - 如何动态调整约束布局中的textview大小以适应不同的屏幕尺寸?

html - 输入的接受属性无法识别应用程序/json?

html - 为什么我的网站在移动 View 中有水平滚动条?

html - 导入特定 Material 图标