Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML Select DropDown list with multiple colours

Is it possible to have different colours for different items in the dropdown list?

For example:

Option 1 = green
Option 2 = blue
etc

like image 419
mouthpiec Avatar asked Apr 27 '10 10:04

mouthpiec


People also ask

How do I show colors in dropdown?

In the lower section, change the first drop down setting (Cell Value) to Specific Text. Change the second drop down to containing. In the third control, enter =A1, the cell that contains the text value red. Click the Format button, click the Font tab, choose red, and click OK.

How do I change the color of a selection in dropdown CSS?

To change the selected option color in CSS, we use the :checked pseudo-class selector. The :checked selector targets only the selected option of a dropdown.


1 Answers

here is what you want Styling Dropdown Lists

    <style type="text/css">
    option.red {background-color: #cc0000; font-weight: bold; font-size: 12px;}
    option.pink {background-color: #ffcccc;}
    </style>

    <select name=colors>
    <option class="red" value= "../getting_started/">Getting Started </option>
    <option class="pink" value= "../getting_started/html_intro1.htm">- Intro to HTML
     </option>
    </select>
like image 89
ACP Avatar answered Sep 22 '22 02:09

ACP