Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change Select List Option background colour on hover in html [duplicate]

Tags:

html

css

Is it possible to change the default background color of the 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> 
select {     -webkit-border-radius:25px; -moz-border-radius:25px; border-radius:25px; }  select:hover {         background-color:gren; }  option:hover {     background-color:yellow; }  option {     -webkit-border-radius:25px; -moz-border-radius:25px; border-radius:25px;     color:blue;     background-color:yellow; } 

I have tried option :hover{background-color:red;}, but it is of no use. Does anybody know how to do this?

like image 713
srihari Avatar asked Jul 19 '13 07:07

srihari


People also ask

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

You cannot change the style for these elements.

How do you change the color of hovering in HTML?

When the user hovers the cursor on that text, it changes the color of the text. CSS hover selector method is used for changing the color of the text when you move the cursor on that particular text. Note: The above syntax is used with class or id name to make a hover effect on that element.

How do I change the background color of a selection in HTML?

To change the selected option background-color CSS style, we can set the style attribute of the select and option elements. to set the whole select element to background color 009966 and color FFF . Then we override the the styles in the option elements with style="background: white; color: black;" .

How do you change color when hovering?

To change the color of your link on hover, use the :hover pseudo property on the link's class and give it a different color.


1 Answers

Currently there is no way to apply a css to get your desired result . Why not use libraries like choosen or select2 . These allow you to style the way you want.

If you don want to use third party libraries then you can make a simple un-ordered list and play with some css.Here is thread you could follow

How to convert <select> dropdown into an unordered list using jquery?

like image 85
Kiran Ruth R Avatar answered Sep 23 '22 15:09

Kiran Ruth R