0

Q:

I wanna to change the color of any disabled control to black like in enabled one because of special case, i tried many solutions like make the textbox read only but (i donot want this solution because of some reason of this case) , i use Css file , every thing is changed except the color of the text how to change the color to be more clear please.

EDIT:: tested against IE

My CSS:

input[disabled] { border:solid 1px red; background-color:White;color:red !important;font-weight:bold;font-size:medium; }

My .aspx sample:: <title></title> <link href="StyleSheet1.css" rel="stylesheet" type="text/css" />

<form id="form1" runat="server">
<div>

    <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
    <br />
    <br />
    <br />
    <asp:TextBox ID="TextBox1" runat="server" Enabled ="false"
         ></asp:TextBox>

</div>
</form>

`

Anyname Donotcare
  • 11,113
  • 66
  • 219
  • 392
  • 1
    have a look: http://stackoverflow.com/questions/602070/changing-font-colour-in-textboxes-in-ie-which-are-disabled – Tim Schmelter Jan 18 '11 at 13:41
  • i read it ,,, the answer talk about a Jquery lib i want it,or the steps to use it ,, thanks alot – Anyname Donotcare Jan 18 '11 at 13:48
  • 3
    IE won't let you change the color of disabled textbox, it's in its very core. But don't give up, I'm sure that at some point even IE (maybe 9, maybe 10) will let web developers change disabled textbox color. :) – Shadow The GPT Wizard Jan 18 '11 at 15:43

1 Answers1

3

Use the following CSS2 selector:

input[disabled=disabled] {
 /* your style */
 color: #fff !important;
}
sethvargo
  • 26,739
  • 10
  • 86
  • 156