Skip to main content
17-Peridot
October 9, 2020
Solved

Use CSS to change button color by class (ThingWorx 9.0)

  • October 9, 2020
  • 1 reply
  • 2489 views

I'm struggling with the CSS to change a button's color dynamically (by passing in different class names to the widget).  I'm able to get this to work:

 

#root_ptcsbutton-7:not([no-wc-style]).widget-content {background: #FF0000; !important}

 

But it's tied to the ID of the button.  I'd like to do it by class instead so it can be more generic.

Best answer by nmilleson

Of course I figured it out minutes after I posted... 

 

.myCustomClass .widget-content{background: #FF0000 !important;}

 

seems to do the trick for anyone wondering..

1 reply

nmilleson17-PeridotAuthorAnswer
17-Peridot
October 9, 2020

Of course I figured it out minutes after I posted... 

 

.myCustomClass .widget-content{background: #FF0000 !important;}

 

seems to do the trick for anyone wondering..