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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

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.