How to center text in the table?By Milan Jovanovic on 20/07/18 in

If you need to apply for all tables then just add this code below in Custom wpDataTables CSS under the “Custom JS AND CSS” in main settings of wpDataTables. In this example we align the text in the center of the table, you can change the text-align to your desire by changing the word “center” to “left” or “right.

.wpDataTablesWrapper table.wpDataTable td, 
.wpDataTablesWrapper table.wpDataTable th,
.wpDataTablesWrapper table.wpDataTable td.numdata, 
.wpDataTablesWrapper table.wpDataTable th.numdata
{ text-align: center !important; }

This will be affected on all tables, but if you want just for specific one then insert this code on the CUSTOM CSS under Customize tab in table settings and you will use clases with id’s for that table (Example if your table have id 1)

.wpDataTablesWrapper table.wpDataTable.wpDataTableID-1 td,
​.wpDataTablesWrapper table.wpDataTable.wpDataTableID-1 th,
.wpDataTablesWrapper table.wpDataTable.wpDataTableID-1 td.numdata,
​.wpDataTablesWrapper table.wpDataTable.wpDataTableID-1 th.numdata
{ text-align: center !important; }
Was this answer helpful ? Yes No

Comments are closed.