CSS: Table Cells: Background Color

  • 1
  • Question
  • Updated 4 years ago
I'd like to adjust the color of 2 different "columns" in a table using CSS.  The table has 8 or so columns.  How do I identify only those 2 columns?
Photo of Scott


  • 2,732 Points 2k badge 2x thumb

Posted 5 years ago

  • 1
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 43,156 Points 20k badge 2x thumb
For those two columns, use template fields, allow HTML and set the class in the HTML. Then set CSS as per the class you named in the HTML of the template field.
Photo of Charlie M

Charlie M

  • 102 Points 100 badge 2x thumb
Hi Scott,

Create a Javascript snippet and add that snippet to that field

You can try with this snippet

var $ = skuid.$;var field = arguments[0];
var value = arguments[1];

switch( field.mode ){
    case 'edit':
        skuid.ui.fieldRenderers[field.metadata.displaytype].edit( field, value );

    case 'read':
    case 'readonly':
        var cellElem = field.element;
        var iconElem =
            $( '<div>' )
                .css('background-color', 'salmon');
                .appendTo( cellElem );

Charles M