Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Chrome, <select> element doesn't have background color when disabled

Chrome has default background colors set for disabled inputs, but not for the <select> element when it is disabled. What is the reason for that? It seems like a bug to me.

Open the jsFiddle link in IE, Firefox and Chrome and notice the difference. In IE and Firefox the <input> and <select> both have the same styling. But in Chrome, the elements have different styling. I would expect the <select> element to have the same background color as the <input>.

See jsFiddle

<input disabled value="text" />
<select disabled>
    <option>option</option>
</select>

Chrome

Chrome

Firefox

Firefox

like image 521
iheartcsharp Avatar asked Dec 17 '25 11:12

iheartcsharp


1 Answers

Because that's how the browser's default styles look.

It is doing it correctly as per those.

If you'd like to fix it to match, you can do so with CSS:

select:disabled {
    background-color: rgb(235, 235, 228);
    color: rgb(84,84,84);
}
like image 117
Collin Grady Avatar answered Dec 19 '25 05:12

Collin Grady



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!