我正在使用数据表,想知道是否有一个选项可以使 header 换行。
我用的是紧凑型显示器
问题是,一些 javascript 将表格标题单元格的宽度设置为固定的像素数。
所以我想:
fees
covered
name
shown
amount
shown
在标题中
编辑:添加 <br/>
的问题标记是列的宽度保持完全相同,但我希望它们变得更小,宽度更小,请参见此处:
最佳答案
使用换行符 <br>
在表格标题中:
<table id="example" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>fees<br>covered</th>
<th>name<br>shown</th>
<th>amount<br>shown</th>
</tr>
</thead>
</table>
参见 this jsFiddle用于代码和演示。
关于datatables - 使第 th 个标题单元格包含单词,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36636763/