2

Hi i am using a disabled on my select dropdown as i dont want it to be clickable.. now it is turning my text grey.

Html:

<select disabled>
  <option value="volvo">Volvo</option>
  <option value="saab">Saab</option>
  <option value="mercedes">Mercedes</option>
  <option value="audi">Audi</option>
</select>

I have overwritten it with some css which will hide my dropdown and border etc and also turned the color black:

select {
appearance: none;
-webkit-appearance: none;
-moz-appearance: none; 
border: none;
/* needed for Firefox: */
overflow:hidden;
width: 90%;
background-color: #F2EDE9;
color:black;

}

select::-ms-expand {
    display: none;
}

Now it is fine on all other browsars chrome, FF, safari, but the one i want it to change color on is IE. The disabled select dropdown font color is staying grey. It needs to be a select dropdown so please do not suggest using readonly etc etc.

If anyone has got away round this so it can be turned black it would be very helpful to have.

Thanks Dom

user4058171
  • 213
  • 1
  • 4
  • 9
  • It's apparently not possible. Take a look here: [How to change font-color for disabled input?](http://stackoverflow.com/questions/6186989/how-to-change-font-color-for-disabled-input) – alexP Apr 10 '15 at 09:28
  • Controls are a major pain in the rear to style. If you want your page to look absolutely identical across browsers (and devices), your only choice is to not use controls, but draw the things yourself and throw a whole lot of Javascript at them. – Mr Lister Apr 10 '15 at 09:39

2 Answers2

0

You can try like this:

input[type="text"][disabled] {
   color: red;
}

Source link

Community
  • 1
  • 1
Rahul Tripathi
  • 168,305
  • 31
  • 280
  • 331
-1

Try specifying a colour for the :disabled pseudo class of the select element:

select:disabled{color:#000;}
Shaggy
  • 6,696
  • 2
  • 25
  • 45
  • No, unfortunately, I don't have an up to date version of IE to hand to test. If it's not working using either selector (`select` or `select:disabled`) then it's a bug in IE. Have you tried using an attribute selector as suggested by Rahul? – Shaggy Apr 10 '15 at 09:48