Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change font color of disabled input in Firefox

Tags:

html

css

firefox

When I disable input elements the text is taking the font color: #000000 in Firefox. This is not happening in IE. Please check the below page in IE and Firefox. Let me know how to give it a gray look as in IE.
test

like image 784
Shivanand Avatar asked Dec 17 '08 09:12

Shivanand


People also ask

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.

What is the color of disabled textbox?

In Chrome, it is the system color 'graytext', so you don't need to remember the hex code.

How do you apply style to only those input tags which have disabled attributes to them?

First step: swap the HTML elements order so that the <label> appears after the <input> . This will allow the styling rules to work as desired. Then for the fun bit: use CSS to position the labels for text inputs on the left hand side! input[type=radio]:disabled+label works like a sharm!

How do I make input disabled in CSS?

You can't disable anything with CSS, that's a functional-issue. CSS is meant for design-issues. You could give the impression of a textbox being disabled, by setting washed-out colors on it. Keep in mind that disabled inputs won't pass their values through when you post data back to the server.


1 Answers

Different browsers style disabled elements differently. Here is how you can control the style of disabled elements in Firefox.

[disabled] {
  color:#ff0000;
  background-color:#00ff00;
}
like image 113
ng.mangine Avatar answered Nov 01 '22 08:11

ng.mangine