【发布时间】:2021-07-20 15:10:17
【问题描述】:
我试图将我的表格标题文本居中,但由于 dataTables 样式表添加了 bootstrap 3 图标,我的文本略微向左移动。如何正确居中文本?
<table class="table table-bordered table-hover center-all" id="dataTable">
<thead>
<tr>
<th scope="col" style="text-align: center">Name</th>
<th scope="col" class="headerText">Result</th>
</tr>
</thead>
</table>
这是目前的结果:
编辑:
这是 dataTables 添加填充的地方,有没有办法禁用它?
【问题讨论】:
-
你能把这些图标设置在样式表中的绝对位置吗?
-
我们如何测试你写的东西?我们必须猜测?当涉及到asking a good question 时,您可能会发现阅读网站help section 很有用。为了获得您问题的最佳答案,我们希望看到您首先尝试使用minimal reproducible example 自己解决问题。这是question checklist,您可能会觉得有用...
-
只用css就可以解决。在图标上尝试
position: absolute; right:0并设置position: relative。 -
@Kinglish 我不确定这是否可能,因为图标是由 dataTables 动态添加的。我可以这样做吗?
标签: javascript html css datatables