/    Sign up×
Community /Pin to ProfileBookmark

Color of a Drop Down List

Hi, I;m a little new to this game so please be patient.

I have a drop down list of states and I’d like the entries to be a specific color. I have a class defined as :

.dropdown {
font-family: Arial, Helvetica, sans-serif;
width: 286px;
font-size: 12px;
color: #FF0000;
}

And a cell in a table …
<td valign=”top”>
<select name=”state” class=”dropdown” >
<option value=” “>&nbsp;</option>
<option value=”AL”>Alabama</option>
<option value=”AK”>Alaska</option>
<option value=”AZ”>Arizona</option>

<option value=”AR”>Arkansas</option>
<option value=”CA”>California</option>
<option value=”CO”>Colorado</option>
</select> </td>

But the color is still black?

Any help would be appreciated.

Thanks,
hefterr

to post a comment
CSS

4 Comments(s)

Copy linkTweet thisAlerts:
@kenderMay 06.2009 — I believe you need to assign the class to your option tag

http://www.java2s.com/Code/HTMLCSS/Form-Style/Styleforselectoption.htm
Copy linkTweet thisAlerts:
@budsterMay 06.2009 — Hi hefterr

This article explains how to have multi-coloured select lists

http://www.astral-consultancy.co.uk/cgi-bin/hunbug/doco.cgi?11580

Hope this helps
Copy linkTweet thisAlerts:
@hefterrauthorMay 06.2009 — Hey,

Thanks to all for the help.

The only thing that doesn't seem to work 100% is with the Safari browser. I can get the drop down OPTION elements to be colored, but when I select one (only with Safari), the color is ignored and the selected choice is black.

Any ideas?

hefterr
Copy linkTweet thisAlerts:
@budsterMay 07.2009 — Hi hefterr

With Safari 3, I also couldn't get a select list to be anything but black, even adding the css "select{color:blue}" didn't have any effect.

But Safari 4 (on windows) does work in the desired way.

Hope this helps
×

Success!

Help @hefterr spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.26,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...