• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Colored Text in Pull-down Menu

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello!
i was wondering if there is a way to make the text in the pull-down menu colorful.
i tried using the <font color=""> tags between the text after the option tag like:
<select>
<option><font color="red">test1</font>
</select>
i've also tried to put the font tags before and after the select tags, but nothing happened.
i've tried looking for the answers in all the books i could get but no answer still. google was no help either.
would really appreciate it if someone could help.
tia
jacq
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can do it with CSS....
here are the two ways
first way is to do it for the entire dropdown
<form>
<p><select size="1" name="D1" style="color: #FF0000">
<option value="A">A</option>
<option value="B">B</option>
</select></p>
</form>
Second one is to do it individually
<form>
<p><select size="1" name="D1" >
<option value="A" style="color: #FF0000">A</option>
<option value="B" style="color: #00FF00">B</option>
<option value="C" style="background: #00FF00">B</option>

</select></p>
</form>

Hope this helps
 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Eric,
How do you keep the color if you select one of the options? I have a drop down with 1 red element, but when you choose it , it comes up black in the select box.
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As I said in your post you can not do it. It is a browser property and not anything that relates to the selection list.

Eric
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Brian, please do not hijack other people's topics. You should have pursued this in the topic you opened for this issue.
 
permaculture is giving a gift to your future self. After reading this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic