• Resolved jakemaspin

    (@jakemaspin)


    Hello, I’m struggling to find out how to set up the CSS so that the background colour of rows only affects that table. I have tried putting the id of the page before:

    .sp-league-table tbody tr:nth-last-child(1), .sp-league-table tbody tr:nth-last-child(2), .sp-league-table tbody tr:nth-last-child(3) {
    background: #DD3333 !important;
    color: white !important;
    }

    Thanks.

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • @jakemaspin

    You need to use an ID selector from your published page in order to target the class for that table. In the case you posted, your article ID is post-296
    Therefore, to target just this table, on just this page, you need to use (something like) this :

    #postid-296 .sp-league-table tbody tr:nth-last-child(1), #postid-296 .sp-league-table tbody tr:nth-last-child(2), #postid-296 .sp-league-table tbody tr:nth-last-child(3) {
    background: #dd3333!important;
    color: white !important;
    }

    For each page where your table is displayed, you can get the new post-ID.

    This is not a great implementation, but should work the way you expect.

    Thread Starter jakemaspin

    (@jakemaspin)

    I’ve tried putting #postid-296 infront of the .sp however it hasn’t worked.

    Roch

    (@rochesterj)

    Hi!

    Thanks for testing. Please try it as a class and with this version:
    .page-id-296

    That’s the class we have in your body tag. So your final code should be:

    .page-id-296 .sp-league-table tbody tr:nth-last-child(1), .page-id-296 .sp-league-table tbody tr:nth-last-child(2), .page-id-296 .sp-league-table tbody tr:nth-last-child(3) {
        background: #dd3333!important;
        color: white !important;
    }

    Thanks

    Thread Starter jakemaspin

    (@jakemaspin)

    brilliant, that worked thanks. How do you find the page id’s when i look up in source nothing shows up.

    Thread Starter jakemaspin

    (@jakemaspin)

    Okay nevermind, i’ve found it. Thanks @rochesterj !

    Roch

    (@rochesterj)

    You’re most welcome!

    Let us know if you need anything else.

    Kind Regards,
    -Roch

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Changing background colour to specific rows in a specific table’ is closed to new replies.