Change background color of table

  • Author
    Posts
  • #155095

    metbaseball
    Member
    Original poster

    I would like to change the background color (except in the header row, which I would like to stay the same) in a table.

    In the CSS code, I made the change below (background-color line), but it does not seem to be working.

    table {
    	margin-bottom: 15px;
    	background-color: #90EE90;
    }

    The table is in a draft, so it is not yet visible. I hope that is not a problem.

    Howard

    The blog I need help with is: batsandstats.com

    #155105

    binarymoon
    Theme Author

    Try table tr instead of just table for the background color selector.

    table tr {
    	background-color: #90EE90;
    }

    Make sure in the editor you have enabled table headings and then the heading (a th) should not be changed.

    #155118

    metbaseball
    Member
    Original poster

    I added your code but the background color is still unchanged.

    Here is a link to my post.

    The table I am seeking help with has this in its first row: Don Newcombe 1 MVP

    To access the post, use this password: tablecolor

    Howard

    #155162

    binarymoon
    Theme Author

    Hi Howard – Thanks for the demo. Makes it a lot easier to see the problem!

    If you change the code I gave you to this:

    table tr {
        background-color: #90EE90 !important;
    }

    Then it will work. However you will need to change the table settings in the block properties, and enable the ‘header section’ so that the top row has a different style to the rest of the rows. Otherwise the whole table will turn green.

    Thanks – Ben

The topic ‘Change background color of table’ is closed to new replies.