This is a migrated thread and some comments may be shown as answers.

Cannot set backgroung color using CssClass

1 Answer 64 Views
Input
This is a migrated thread and some comments may be shown as answers.
Edwin
Top achievements
Rank 1
Edwin asked on 19 Oct 2008, 04:14 PM
Hi there
I cannot figure out why the input box in the following code does not appear yellow.  Please help.
Regards
Edwin

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style type="text/css">
        .yellowbg
        {
            background-color: #FFFF00;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div>
        <telerik:RadTextBox ID="RadTextBox1" runat="server" CssClass="yellowbg"
            Width="125px">
        </telerik:RadTextBox>
    </div>
    </form>
</body>
</html>

1 Answer, 1 is accepted

Sort by
0
Accepted
Dimo
Telerik team
answered on 20 Oct 2008, 06:51 AM
Hi Edwin,

The CSS styles for RadInput textboxes have a specificity of 22 so that they are not easily overridden by other controls and styles on the page.

In order to set a background color with a CSS class, please use the following CSS rule:

html  body  form  .radInput_SkinName  .yellowbg
{
    background: #ff0 ;
}

The above CSS selector has specificity of 23 (1 + 1 + 1 + 10 + 10), so it will override the skin.


All the best,
Dimo
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Input
Asked by
Edwin
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Share this question
or