javascript 减少dataTable tr高度
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25728709/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-28 04:55:19 来源:igfitidea点击:
Reduce dataTable tr height
提问by Nk SP
I am using dataTable jquery plugin.
I need to reduce the height of the rows, how can I do it? (I need a fixed height)
我正在使用 dataTable jquery 插件。
我需要减少行的高度,我该怎么做?(我需要一个固定的高度)
I tried:
我试过:
.dataTables tbody tr {
min-height: 35px; /* or whatever height you need to make them all consistent */
}
回答by Mysteryos
tr
don't have height.
tr
没有身高。
You'll have to apply the height
to its td
s
你必须将 应用height
到它的td
s
回答by colin0117
回答by Mahmoud Zalt
Set this in your CSS:
在你的 CSS 中设置:
<style>
td {
white-space: nowrap;
max-width: 100%;
}
</style>
These DataTable options will make it even better:
这些 DataTable 选项将使它变得更好:
scrollY: "530px",
scrollX: true,
scrollCollapse: true,