You are viewing limited content. For full access, please sign in.

Question

Question

CSS to change color of text in a dropdown field within a table

asked on June 30, 2022

I have a dropdown field within a table that I trying to change the color of each item in that list. For example High would be Red and Low would be Green.

#Field15 > option:nth-child(2) {color:red!important;}

I have tried that CSS that works on a dropdown outside of a table. Using Classic Designer

0 0

Answer

SELECTED ANSWER
replied on July 1, 2022

The issue is that you are referring to the field by it's ID, which is unique to each field.  In the table, the ID is not only unique for the field, but will be modified for each row.  So instead of #Field15, it's going to be #Field15(1), #Field15(2), #Field15(3), etc.

I recommend using CSS Classes instead.

If you add the CSS Class of dropdownColors to your drop-down field(s) and then add CSS such as this, it should work both inside and outside the table: 

.dropdownColors select > option:nth-child(2) {color:red!important;}

 

0 0
replied on July 3, 2022 Show version history

Hi Matthew, 

Thanks for your response. 

This works in the Classic Designer, which is what I wanted.

Doesn't work in the Modern Designer though. Weird.

0 0
replied on July 4, 2022

The structure of fields in the modern designer is drastically different than the classic designer.  Much of the CSS for one won’t work the same for the other.

0 0

Replies

You are not allowed to reply in this post.
You are not allowed to follow up in this post.

Sign in to reply to this post.