Anyname Donotcare
Anyname Donotcare

Reputation: 11393

how to change the color of disabled controls

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>

`

Upvotes: 0

Views: 7469

Answers (1)

sethvargo
sethvargo

Reputation: 26997

Use the following CSS2 selector:

input[disabled=disabled] {
 /* your style */
 color: #fff !important;
}

Upvotes: 3

Related Questions