aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Colored Text in Pull-down Menu Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Colored Text in Pull-down Menu" Watch "Colored Text in Pull-down Menu" New topic
Author

Colored Text in Pull-down Menu

jacq carballo
Ranch Hand

Joined: Feb 10, 2002
Posts: 42
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
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
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
Brian Quinn
Ranch Hand

Joined: Dec 23, 2003
Posts: 32
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
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
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
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60992
    
  65

Brian, please do not hijack other people's topics. You should have pursued this in the topic you opened for this issue.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Colored Text in Pull-down Menu