如何将焦点css应用于所有下拉?

时间:2021-08-19 07:24:46

I have below class for all textboxes

所有文本框都有以下课程

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;
}

Can i use this same css class for type dropdowns?

我可以使用同一个css类进行类型下拉列表吗?

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

2 个解决方案

#1


1  

an asp:DropDownList is rendered as a select in HTML.

asp:DropDownList呈现为HTML中的选择。

So, to implement the focus CSS on all drop-downs, add the following to your CSS rules:

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

select:focus{}

So your code becomes like so:

所以你的代码变成这样:

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;
}

#2


1  

​select:focus {
    background-color:red;
}​

will be used for dropdown lists.

将用于下拉列表。

Example http://jsfiddle.net/c8wjL/

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

#1


1  

an asp:DropDownList is rendered as a select in HTML.

asp:DropDownList呈现为HTML中的选择。

So, to implement the focus CSS on all drop-downs, add the following to your CSS rules:

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

select:focus{}

So your code becomes like so:

所以你的代码变成这样:

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;
}

#2


1  

​select:focus {
    background-color:red;
}​

will be used for dropdown lists.

将用于下拉列表。

Example http://jsfiddle.net/c8wjL/

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