How to override dataTable header text-align: left;
How to override dataTable header text-align: left;
FoxRocks76
Posts: 5Questions: 3Answers: 0
I'm upgrading from v1 to v2 and my headers won't center now. I "inspected" the header row and found this overriding my style:
table.dataTable thead th, table.dataTable thead td, table.dataTable tfoot th, table.dataTable tfoot td {
text-align: left;
}
I checked the documentation and didn't see anything that addresses this, and a form search didn't help either.
Appreciate any help you can provide!
This question has an accepted answers - jump to answer
Answers
Looking at this Datatables 1.13.10 example it looks like the same CSS is applied:
Looks like applying this CSS will override the Datatables CSS in DT 2:
Test case:
https://live.datatables.net/canifuhe/1/edit
Please provide a link to a test case replicating the issue so we can help debug.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Or you can try applying the
columns.className
dt-head-center
as described in the Styling docs.Kevin