Support » Plugin: TablePress » CSS target for alternating colors in specific table

  • Resolved TripleBla



    I have ten tables where odd and even rows have the same color. For the 11th table I would like to have alternating colors.

    CSS for my ten tables

    .tablepress .odd td {
    	background-color: #f3f3f3;
    .tablepress .even td {
    	background-color: #f3f3f3;

    CSS for my 11th table with alternating colors

    .tablepress-id-11 .odd td {
    	background-color: #f3f3f3;
    .tablepress-id-11 .even td {
    	background-color: blue;

    With this code I do not get alternating colors in Table 11. I need to add “!important” after “blue” for that. However this has some drawbacks:

    – no Hover effect
    – changes color of the first column (different from the rest of the columns)

    The question remains:

    How can I target the odd and even rows for a specific table while keeping my general settings? Is it possible to target specific columns in alternating rows?


Viewing 1 replies (of 1 total)
  • Plugin Author TobiasBg


    Hi Pete,

    thanks for your post, and sorry for the trouble.

    First of all, why are you setting the alternating row colors to the same value for the 10 tables? Instead, just turn off that feature on their “Edit” screens.

    Now, some themes might require to use the !important keyword, unfortunately. That then means that you’ll have to repeat the declaration of the CSS property that now no longer works, as well (also with the !important keyword). Does that make sense?
    In your case, you’d most likely have to do that for the hover effect then, and for that first column color change.

    So, in summary, your code of targetting odd and even rows for a single table is totally correct. You might just have to tweak your general settings.

    To target a specific column in the odd/even rows, you’d use

    .tablepress-id-11 .odd .column-2 {
    	background-color: #ff0000;
    .tablepress-id-11 .even .column-4 {
    	background-color: #00ff00;


Viewing 1 replies (of 1 total)
  • The topic ‘CSS target for alternating colors in specific table’ is closed to new replies.