We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now


stylesheet for combo box

Medium Priority
Last Modified: 2010-04-09
Hi All,
I have one combobox in my form.
The contents are displayed in the following manner in the combobox :

Test1   (AAAAA)   -- 11111
Test2   (BBBBBB)   -- 22222
Test3   (CCCCCC)   -- 333333
Test4   (DDDDDD)   -- 444444
Test5   (EEEEEE)   -- 555555

..... so on

I want to display Test1, Test2, Test3... in different colors...Similarly "AAAAAA", "BBBBBB", "CCCCCC"...in different color...and "11111", "222222" ...in different color...

Thanks in advance...
Meenakshi Dhar
Watch Question

Each item will have to be one color.

All of: Test1   (AAAAA)   -- 11111 can be red
All of: Test2   (BBBBBB)   -- 22222 can be blue

But you can't do: Test1(in red) (AAAAAA)in blue --111111(in green)

To change the item color you just add a color style to <option>

<option value="blah" style="color: #cccccc">blah</option>


Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts


Ok is it not possible at all?? I mean any other way to do it.....

sam is right, you can only change the color of options tags.
No way to put two different colors in a single option tag.
If you really want to do so, you will have to make your own custom combo-like control with JavaScript/CSS.

if you fill your data from database and your page is for instance asp  you could do like this , and define array of colors and set it for each data which you read from database instead of fixed color which I used in below (  "color:black"   )
"color:" & arr(1)

<select size="19" class="MT" name="D1"  style="border: 0px solid #285007; padding: 0; background-color: #EEEEEE; scrollbar-highlight-color:#00ff00; scrollbar-base-color:green ; font-weight:bold" >

          while NOT RS.EOF%><option
          Response.write "yourvalue"))

then it means you could only have one color for each option as others told u


yes.. sara110 is right...
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.