0

我的表单有这些 css,但下拉列表/选择缺少 css。我需要与以下相同的格式:

CSS:

form input[type="password"], form input[type="text"] {
display: block;
width: 94%;
margin: 5px 0;
padding: 8px;
color: #777;
font-family: Arial;
font-size: 13px;

-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;

border: 1px solid #ADADAD;
outline: none;
}

form textarea {
display: block;
width: 94%;
margin: 5px 0;
padding: 8px;
color: #777;
font-family: Arial;
font-size: 13px;
overflow: auto;
resize: none;

-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;

border: 1px solid #ADADAD;
outline: none;
}
4

2 回答 2

1

您应该根据输入的类型使用 CSS 类名称。例如,文本输入应该有一个 CSS 类名“TextBox”,检查输入应该有一个 CSS 类名“CheckBox”,您可以单独设置所有 css 属性。您还可以在单​​个元素上设置多个 CSS 类名称,例如"Control TextBox Disabled","Control CheckBox""Control Label Red-Text".

您也可以使用 JQuery 选择器并找到任何类型的输入并做任何您想做的事情。

我希望这有帮助:

.Control
{
    display: block;
    width: 94%;
    color: #777;
    font-family: Arial;
    font-size: 13px;
}

.TextBox-Base
{
    -webkit-border-radius: 5px;
    -moz-border-radius: 5px;
    border-radius: 5px;
    border: 1px solid #ADADAD;
    outline: none;
    margin: 5px 0;
    padding: 8px;
}

.TextBox, 
.PasswordBox
{
}

.RichTextBox
{
    overflow: auto;
    resize: none;
}

.DropDownList
{
}

HTML 示例代码:

<input type="text" class="Control TextBox-Base PasswordBox" />
<input type="password" class="Control TextBox-Base PasswordBox" />

<textarea class="Control TextBox-Base RichTextBox"></textarea>

<select class="Control DropDownList" ></select>

使用 JQuery 选择元素:

$(".TextBox-Base") //returns all the elements that has "TextBox-Base" class name included.

$(".TextBox") //returns all the elements that has "TextBox" class name included.

$(".PasswordBox") //returns all the elements that has "PasswordBox" class name included.

$(".RichTextBox") //returns all the elements that has "RichTextBox" class name included.

$(".DropDownList") //returns all the elements that has "DropDownList" class name included.

干杯

于 2012-09-11T11:54:18.530 回答
0

您可以使用选择选择

form select {

}
于 2012-09-11T11:51:40.833 回答