Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the Color of the hovered Select-Option in FireFox

I want to change the Color of the hovered Select-Option in FireFox which has default blue background and white foreground.

I tried:

<select name="select" size="1">
   <option>0</option>
   <option class="test">1</option>
   <option>2</option>
   <option>3</option>
   <option>4</option>
</select>

.test:hover {
    color:green;
    background-color:yellow;
    text-decoration:underline;
}

But it doesn't work. See Example.
A FireFox specific solution is sufficient.

like image 726
oliholz Avatar asked Aug 11 '11 14:08

oliholz


People also ask

Is it possible to change the default background color of a select list option on hover?

Select / Option elements are rendered by the OS/Client, not HTML. You cannot change the style for these elements in modern Browser.

How do I use color picker in Firefox?

On the top, there is a toolbar with 3 buttons. In the middle, there is a big icon (color-palette icon) which can be used to render the native color picker UI. Click on this icon to pick a new color. Please note that, depending on your browser and OS, the native color picker UI may vary significantly.

How do I change the color of my banner in Firefox?

Chosen solution Hi, if you mean the Firefox UI toolbars, open the 3-bar menu > Customize, then Themes (at the bottom of the window) and select 'Light' then click Done to save.


2 Answers

SELECT elements are rendered by the OS, not HTML. You cannot style this element.

You can use a HTML+CSS replacement using JavaScript to simulate SELECT though.

like image 114
Diodeus - James MacFarlane Avatar answered Sep 23 '22 20:09

Diodeus - James MacFarlane


It cannot be done with CSS alone. I recommend a jQuery + Chosen plugin replacement for the <select>

like image 43
andyb Avatar answered Sep 23 '22 20:09

andyb