CSS无法更改项目背景颜色

时间:2019-07-18 08:45:45

标签: css asp.net telerik

我有telerik rad DropDownList,我想将一项的背景颜色更改为黄色。 这是aspx,我将cssClass放入了unknown css

<div class="col-md-3 customColumnPadding" id="uiColumnClasses" runat="server">
        <telerik:RadDropDownList ID="uiClasses" runat="server" Width="100%">
            <Items>
                <telerik:DropDownListItem runat="server" Text="<%$ Resources:Resource,Unknown %>" Value="22001" cssClass ="unknown"/>
                <telerik:DropDownListItem runat="server" Text="<%$ Resources:Resource,Business %>" Value="22002" />
                <telerik:DropDownListItem runat="server" Text="<%$ Resources:Resource,Economy %>" Value="22004" Selected="true" />
                <telerik:DropDownListItem runat="server" Text="<%$ Resources:Resource,First %>" Value="22003" />
                <telerik:DropDownListItem runat="server" Text="<%$ Resources:Resource,Premium_Economy %>" Value="22005" />
            </Items>
        </telerik:RadDropDownList>
    </div>

这是css文件的内容:

.RadDropDownList_MetroTouch .rddlFocused
{
    border-color: #486190 !important;
    background-color: #486190 !important;
}

.unknown
{
    border-color: #FFFF00 !important;
    background-color: #FFFF00 !important;
}

但是,我发现在浏览器的检查器中,css类unknown不存在。并且项目颜色不变。这是从检查员那里获得的内容。您可以看到值“未知”没有css类unknown

<div id="ctl00_ContentPlaceHolder1_UsageControl0_UsageControl58_uiClasses" class="RadDropDownList RadDropDownList_MetroTouch" style="width:100%;" tabindex="0">
                    <span class="rddlInner rddlFocused">
                    <span class="rddlFakeInput">Unknown</span>
                    <span class="rddlIcon">
                    <!-- &nbsp; -->
                    </span></span>
                    <input id="ctl00_ContentPlaceHolder1_UsageControl0_UsageControl58_uiClasses_ClientState" name="ctl00_ContentPlaceHolder1_UsageControl0_UsageControl58_uiClasses_ClientState" type="hidden" autocomplete="off">
                </div>

出什么问题了?如何将项目更改为黄色(值为未知)?

0 个答案:

没有答案