Change The 'option' Color With The Attribute 'disabled'


Answer :

It can't be both selected and disabled.

option:disabled {   color: red; }
<select>   <option selected>Choose something</option>   <option disabled>1</option>   <option>2</option>   <option>3</option> </select>

If you want to disable the select, instead of the option you need to moved disabled to the select tag

select:disabled {   color: red; }
<select disabled>   <option selected>Choose something</option>   <option>1</option>   <option>2</option>   <option>3</option> </select>


Try this:

CSS:

    select{     color:red;     }     option{     color:black;     } 

try this, hope it will work: in html:

    <select>       <option value="">Choose something</option>        <option disabled="disabled" value="" class="red">1</option>        <option disabled="disabled" value="" class="red">2</option>        <option disabled="disabled" value="" class="red">3</option>     </select> 

in CSS:

   select :disabled.red{    color: red;    } 

Comments

Popular posts from this blog

Are Regular VACUUM ANALYZE Still Recommended Under 9.1?

Can Feynman Diagrams Be Used To Represent Any Perturbation Theory?