Jump to content
Sign in to follow this  
imgrooot

is there a way to add a different color for the select disabled option?

Recommended Posts

I want to change the color of an option that's disabled. By default it's showing grey. 

<option disabled="true" class="disabled">Heading One</option>

I tried using the "disabled" class to change the color but it doesn't work. But for some reason I can change it's size.

Is there a way around this that would work in all browsers?

Share this post


Link to post
Share on other sites

Never mind. I was able to do it using this method.

option:disabled {
	color: red;
}

 

Share this post


Link to post
Share on other sites

I should also mention that I was trying to make the grayed out disabled text into black color. Which is why it wasn't working for me. Seems like I can color the text any other color except black.

Share this post


Link to post
Share on other sites

You can make it a color that's really close to black.  For example, rgb(0,0,1);

A person wouldn't be able to tell the difference.  It's not rgb(0,0,0) though so the browser doesn't change it to the normal disabled gray.

 

Share this post


Link to post
Share on other sites
18 hours ago, kicken said:

You can make it a color that's really close to black.  For example, rgb(0,0,1);

A person wouldn't be able to tell the difference.  It's not rgb(0,0,0) though so the browser doesn't change it to the normal disabled gray.

 

That's good to know.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.