Reputation: 63
I have the following CSS to insure that all readonly textboxes have the background color set to grey...
input[readonly]
{
background-color: #ddd;
}
But now I want to override that style for a TextBox with CssClass="WarningText" but the following does not work...
.WarningText
{
background-color: #ffff99;
}
How can I get the .WarningText style to override the default input[readonly] style?
Upvotes: 0
Views: 1385
Reputation: 114990
You need to chain the attribute and class selector(s) like so:
input[readonly] {
background-color: grey;
}
input[readonly].WarningText {
background-color: red;
}
<input type="text" class="WarningText" readonly/>
Upvotes: 1
Reputation: 7462
Use this.
input[readonly="readonly"].WarningText
{
background-color: #ffff99;
}
Upvotes: 0
Reputation: 351
You will want to use valid CSS Selectors so like @paulie_d said input[readonly].WarningText
should do what you are expecting it to do. http://www.w3schools.com/cssref/css_selectors.asp
Upvotes: 0