Title: How can I change the colors used for marking alternating rows?
Author: Tobias Bäthge
Published: December 2, 2012
Last modified: December 27, 2025

---

Back to: [Frequently Asked Questions](https://tablepress.org/faq/?output_format=md)•
[Documentation](https://tablepress.org/documentation/?output_format=md)

# How can I change the colors used for marking alternating rows?

This can be done with the some CSS code that needs to be added to the “Custom CSS”
textarea on the “Plugin Options” screen of TablePress:

    ```language-css
    .tablepress {
    	--odd-text-color: #111111;
    	--odd-bg-color: #f9f9f9;
    	--even-text-color: #111111;
    	--even-bg-color: #ffffff;
    }Code language: CSS (css)
    ```

Here, the lines starting with `--` indicate [variables](https://developer.mozilla.org/en-US/docs/Web/CSS/Guides/Cascading_variables/Using_custom_properties)
for the colors, with `text` being the text color and `bg` denoting the background
color, either for odd or even rows. Just change the HEX color values as desired.
You only need to specify the lines that you want to change.

If you prefer a visual interface for changing colors, check out the [Default Style Customizer](https://tablepress.org/modules/default-style-customizer/)
feature that is part of the [TablePress premium license plans](https://tablepress.org/pricing/).

If you just want to change this for a specific table, use `.tablepress-id-N` (with`
N` being the table’s ID) as the selector, instead of `.tablepress`.

If the CSS code from above does not work, you can also try this alternative CSS 
code:

    ```language-css
    .tablepress > :where(tbody.row-striping) > :nth-child(odd) > * {
    	background-color: #ff0000;
    	color: #00ff00;
    }
    .tablepress > :where(tbody.row-striping) > :nth-child(even) > * {
    	background-color: #00ff00;
    	color: #0000ff;
    }Code language: CSS (css)
    ```

You can change both the text colors (via the `color` property) and the background
colors (via the `background-color` property) of odd and even rows.