input标签 css设置

来源:百度知道 编辑:UC知道 时间:2024/06/03 16:26:17
css定义 html标签input

但单选 和多选 按钮 想和 其他input域区分设置

问 可否直接设置css 针对input (非定义样式套用)
可否用css选择器 区分单选和多选 ?

input {
font-size: 12px;
height: 16px;
border: 1px solid #1675AD;
margin: 0px;
padding: 0px;
}

可以用选择器来做,但CSS不能直接区分radio和checkbox,这个需要有父选择器来控制。

举例说明一下:

<div class="radio">
<input type="radio" value="单选1" />单选1
<input type="radio" value="单选2" />单选2
<input type="radio" value="单选3" />单选3
</div>

<div class="checkbox">
<input type="checkbox" value="复选1" />复选1
<input type="checkbox" value="复选2" />复选2
<input type="checkbox" value="复选3" />复选3
</div>

CSS定义:
/*---单选样式--*/
.radio input{
width:40px;
border:#ff0000 1px solid;
}

/*---多选样式--*/
.checkbox input{
width:100px;
border:#0000ff 1px solid;
}

在input标签中加入 style属性
例如:
<input type="text" style="width: 171px ; height: 80px" />