Built something you're proud of? Tell the story. A quick G2 review of App Engine or Build Agent helps other developers see what's possible on ServiceNow. Share your experience.

CSS Classes and Rules

tomasscerba
Mega Sage

Hi All,

 

does anyone figure it out how to apply CSS rules in UI Builder and what they are for? ServiceNow Docs regarding this topic is a joke.

 

Create custom style classes and rules • Australia Build or modify applications • Docs | ServiceNow

 

Has anyone ever figured it out how to for example apply some CSS on :hover?

 

Any help would be appreciated.

 

Thanks.

7 REPLIES 7

Naveen20
ServiceNow Employee

Can you give the exact component and use case

Hi @Naveen20 ,

 

there is no use case. How should I use css rules? Documentation should provide me with example.

Fernnn
Tera Contributor

I wish I could tell you. I've been wondering the same thing. I've used custom page CSS classes applied with data binding, but I'm as clueless about rules as you are. CSS rules may as well not exist from my perspective.
As far as I can tell, pseudoclasses aren't an option. They certainly aren't in the custom CSS classes section.

Hi @Fernnn ,

I've managed to apply rule to button component via script. So, I have repeater with few buttons, where I wanted to apply different background color of bare button if it's active.

 

tomasscerba_0-1776238515931.pngtomasscerba_1-1776238577899.png

And it actually works!