Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What color do disabled text-boxes in html uses?

Tags:

html

css

colors

my question says it all. I'm interested in the text color and the background color that disabled text-boxes in HTML use ( the entire CSS a disabled text-box use is also welcomed ). I need this so I would match the color settings of some readonly text-boxes with the color of disabled text-boxes in my html page ( don't want them to stick out ).

P.S. I need readonly text-boxes so I can capture events with them.

like image 897
ssbarbee Avatar asked Apr 23 '13 18:04

ssbarbee


People also ask

What is the color of disabled textbox?

The background color for a disabled input in chrome is rgb(235,235,228) if that helps .. In firefox the disabled input background-color is F0F0F0.

How do you change the font color for disabled input?

Approach: With adding basic CSS property we are able to change the font-color of a disabled input. The disabled input element is unusable and un-clickable. This is a boolean attribute. Here using the color property of input we can change the font-color of this disabled input element.

Which colors can be used in HTML?

HTML used to recognize 16 color names ("black", "white", "gray", "silver", "maroon", "red", "purple", "fushsia", "green", "lime", "olive", "yellow", "navy", "blue", "teal", and "aqua"), but new browsers can recognize 147 CSS3 color names.

How do I add color to a text box in HTML?

To add background color in HTML, use the CSS background-color property. Set it to the color name or code you want and place it inside a style attribute. Then add this style attribute to an HTML element, like a table, heading, div, or span tag.


2 Answers

The background color is rgb(235, 235, 228); or #EBEBE4 in hex.

At least that's the value in chrome (checked with the debugger tools). This value could be different in other browser

like image 75
Kenneth Avatar answered Sep 21 '22 03:09

Kenneth


I implemented the following to make any read-only textbox or textarea (useful in my case) appear disabled when it was readonly.

<style>
input:read-only, 
textarea:read-only,
[contenteditable]:read-only {
  cursor: not-allowed;
  background-color: #EBEBE4 !important;
  color: #C6C6C6;
} 
</style>

Or this:

<style>
input:read-only, 
textarea:read-only,
[contenteditable]:read-only {
  pointer-events: none;
  background-color: #EBEBE4 !important;
  color: #C6C6C6;
}
</style>

Hopefully this helps someone!

like image 41
EGC Avatar answered Sep 21 '22 03:09

EGC