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

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 page where is that table between the style tag (<style>Code here</style>).

<style>
.wpDataTablesWrapper table.wpDataTable td, 
.wpDataTablesWrapper table.wpDataTable th,
.wpDataTablesWrapper table.wpDataTable td.numdata, 
.wpDataTablesWrapper table.wpDataTable th.numdata
{ text-align: center !important; }
</style>
Was this answer helpful ? Yes No

Comments are closed.