0

我对所有文本框都有以下课程

textarea:focus,input[type="text"]:focus,input[type="password"]:focus
{
border-color:#BBBBBB;
box-shadow: inset 0 0 2px #888;
border-color:#3C8CDD;
color: #063E61;
color: rgb(171, 171, 171);
color:#063E61;
border-color: #3C8CDD;
font-family:Verdana;
font-size: 10px;
font-size:normal;
}

我可以将相同的 CSS 类用于类型下拉列表吗?

 <asp:DropDownList ID="EnqDDL" runat="server" TabIndex="1" AutoPostBack="true" CssClass="dropdown" OnSelectedIndexChanged="EnqDDL_SelectedIndexChanged" ValidationGroup="Save_Group">
                                                        </asp:DropDownList>
4

2 回答 2

1

an在 HTMLasp:DropDownList中呈现为 a 。select

因此,要在所有下拉列表中实现焦点 CSS,请将以下内容添加到您的 CSS 规则中:

select:focus{}

所以你的代码变成了这样:

textarea:focus,input[type="text"]:focus,input[type="password"]:focus,select:focus
{
    border-color:#BBBBBB;
    box-shadow: inset 0 0 2px #888;
    border-color:#3C8CDD;
    color: #063E61;
    color: rgb(171, 171, 171);
    color:#063E61;
    border-color: #3C8CDD;
    font-family:Verdana;
    font-size: 10px;
    font-size:normal;
}
于 2012-12-12T11:11:01.180 回答
1
​select:focus {
    background-color:red;
}​

将用于下拉列表。

示例 http://jsfiddle.net/c8wjL/

于 2012-12-12T11:11:15.610 回答