Support » Plugin: Advanced Custom Fields: Table Field » Apply class to second column

  • Hi! is there a way to apply a class only to the second column? I need to display prices in red an bold and adding the class to every cell is taking a lot of time. Thank you!

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

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Johann Heyne

    (@jonua)

    Hi,

    this can be done without a class on all cells of the second column:

    .table tbody td.nth-child(2) { color: red; font-weight: bold; }

    This style works on every 2th table data cell in the tbody element of a table with the class .table

    Cheers,
    Johann

    • This reply was modified 9 months, 3 weeks ago by Johann Heyne.

    One more question! How can I make the background a different color for every other row?

    I did it! thanks for taking the time to respond, this plugin is really awesome 🙂

    This is what I used in case someone needs it:

    This code to make 3th column different color:
    tr td:nth-child(3){color: #BD1A11!important;}

    This one to make the rows backgrounds alternate color:
    tr:nth-child(even) {background: rgba(234,234,234, 0.8);}
    tr:nth-child(odd) {background: rgba(255,255,255, 0.8);}

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Apply class to second column’ is closed to new replies.