Table of Contents
How to color and style columns in wpDataTables
Say your fruit price table has a column for apples, one for oranges and one for bananas, and you want each column in its own color: green, orange and yellow. Every column in wpDataTables has the same look by default, but you can give a column its own background color, align its content and add CSS classes for anything else, such as a bold font. You can do this with Tabella AI or in the column settings.
How do I color a column with Tabella AI?
Open the table, click Ask Tabella AI and name the column and the color.
- Open the table. Go to wpDataTables → wpDataTables and click the table title.
- Ask Tabella AI. Click Ask Tabella AI and type, for example: Color the Apples column light green.
- Check and save. Tabella AI lists what it changed. Click Save Changes, or Undo table changes to go back.
How do I color and style a column in the column settings?
Set Column color, the alignment or CSS class(es) in the Display tab of the column settings and save the table.
- Open the table. Go to wpDataTables → wpDataTables and click the table title.
- Open the column settings. In the table preview, click the settings icon in the column header, or open the column from Column List above the preview.
- Pick a color. In the Display tab, click Column color and choose the color in the color picker.
- Align the content. Choose Column header alignment and Column cells alignment, for example right for numbers.
- Add CSS classes. In CSS class(es), enter one or more class names separated by a space, for example price-column.
- Save the table. Click Save Changes.
How do I add CSS for a column class?
Write the CSS rules for your class in Custom wpDataTables CSS in the Customize tab of the table, in Custom JS and CSS in the wpDataTables settings, or in your theme. Each table also has its own class, wpDataTableID- followed by the table ID, so you can limit a rule to one table:
.wpDataTableID-2 td.price-column { font-weight: 700; color: #1a3a6b; }
To color cells or rows by their values instead of a whole column, use conditional formatting. To change the colors of the whole table, read How to customize the design of a table.
What should I remember about coloring columns?
Ask Tabella AI for a column color, or set Column color, the alignment and CSS class(es) in the column’s Display tab. Write the CSS for your classes in the table’s Custom wpDataTables CSS, the plugin settings or your theme, and use .wpDataTableID- with the table ID to target one table.
Where can I read more?
These pages cover other ways to style a table: