Is it possible to change the default background color of a select list option on hover?
HTML:
<select id="select">
<option value="1">One</option>
<option value="2">Two</option>
<option value="3">Three</option>
</select>
I have tried option:hover { background-color: red; }
, but it is of no use. Does anybody know how to do this?
Implementing an inset box shadow CSS works on Firefox:
Checked option item works in Chrome:
In FF also CSS filter works fine. E.g. hue-rotate:
https://jsfiddle.net/w3a740jq/4/
this is what you need, the child combinator:
Try it, works perfect.
Here's the reference: http://www.w3schools.com/css/css_combinators.asp
This can be done by implementing an inset box shadow. eg:
Here,
.decorated
is a class assigned to the select box.Hope you got the point.
I realise this is an older question, but I recently came across this need and came up with the following solution using jQuery and CSS:
and the css:
Perhaps this helps someone else.
Select / Option elements are rendered by the OS, not HTML. You cannot change the style for these elements.