Display Colors in Drop Down

S

scott

In a regular drop down form element like below, is there a way to display
associated colors with each option? Basically, I'd like it to look like
Outlook's Label Control drop down that displays a small color block with
each choice.

<select name="sTime"><option selected>--Select Category--
<OPTION value="WORK">Work Schedule</OPTION>
<OPTION value="Meeting">Meetings</OPTION>
<OPTION value="Other">Other</OPTION></select>
 
S

scott

Works great.


Adrienne said:
Sure, just use a little CSS, eg:
<option value="Work" style="background-color:yellow; color:green">Work
Schedule</option>
<option value="Meeting" style="background-color:blue; color:white">
Meetings</option>

You could also do:
<option value="work" class="work">Work Schedule</option>
and assign properties for the work class, .work {background-color:yellow;
color:green}

You might also want to look into the OPTGROUP element, which will group
your elements and can also be styled.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top