Title: Color Specific Columns
Last modified: September 1, 2016

---

# Color Specific Columns

 *  [seedpxwee5](https://wordpress.org/support/users/seedpxwee5/)
 * (@seedpxwee5)
 * [9 years, 12 months ago](https://wordpress.org/support/topic/color-specific-columns/)
 * Hello,
 * Superb plugin btw. But how do I set the background color of some rows/columns?
 * [https://wordpress.org/plugins/advanced-custom-fields-table-field/](https://wordpress.org/plugins/advanced-custom-fields-table-field/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [Johann Heyne](https://wordpress.org/support/users/jonua/)
 * (@jonua)
 * [9 years, 12 months ago](https://wordpress.org/support/topic/color-specific-columns/#post-7483821)
 * [https://css-tricks.com/useful-nth-child-recipies/](https://css-tricks.com/useful-nth-child-recipies/)
 *  Thread Starter [seedpxwee5](https://wordpress.org/support/users/seedpxwee5/)
 * (@seedpxwee5)
 * [9 years, 12 months ago](https://wordpress.org/support/topic/color-specific-columns/#post-7483889)
 * CSS applies to all tables. What if I have the “table” in a “repeater” ACF, and
   each table requires a different styling?
 *  Plugin Author [Johann Heyne](https://wordpress.org/support/users/jonua/)
 * (@jonua)
 * [9 years, 12 months ago](https://wordpress.org/support/topic/color-specific-columns/#post-7483893)
 * You can set different style classes in the table element.
 * CSS
 *     ```
       .style1.table {
           /* your first table styles */
       }
       .style2.table {
            /* your second table styles */
       }
       ```
   
 * HTML
 *     ```
       <table class="style1 table">
       <!--table row and cell elements -->
       </table>
   
       <table class="style2 table">
       <!--table row and cell elements -->
       </table>
       ```
   
 * And then you could use an “choice” field next to the table field in the repeater
   to let the user choose `style1` or `style2`.
 * PHP
 *     ```
       // loop through the repeater rows of data
       while ( have_rows( 'repeater_field_name' ) ) : the_row();
   
           // get the table style choice fields value
           $tablestyle = get_sub_field( 'tablestyle' );
   
           $table = get_sub_field( 'your_table_field_name' );
   
           if ( $table ) {
               echo '<table class="' . $tablestyle . ' table">';
                  // other table elements
               echo '</table>';
           }
   
       endwhile;
       ```
   

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Color Specific Columns’ is closed to new replies.

 * ![](https://ps.w.org/advanced-custom-fields-table-field/assets/icon-256x256.png?
   rev=1962986)
 * [Table Field Add-on for ACF and SCF](https://wordpress.org/plugins/advanced-custom-fields-table-field/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/advanced-custom-fields-table-field/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/advanced-custom-fields-table-field/)
 * [Active Topics](https://wordpress.org/support/plugin/advanced-custom-fields-table-field/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/advanced-custom-fields-table-field/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/advanced-custom-fields-table-field/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Johann Heyne](https://wordpress.org/support/users/jonua/)
 * Last activity: [9 years, 12 months ago](https://wordpress.org/support/topic/color-specific-columns/#post-7483893)
 * Status: not a support question