Html 如何定义字段集边框颜色?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3741333/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I define fieldset border color?
提问by Kali Charan Rajput
I want to set border color of field set. I am using class but this is not working properly because i want to remove fieldset default border color. so how can I use fieldset border color.
我想设置字段集的边框颜色。我正在使用类,但这不能正常工作,因为我想删除字段集默认边框颜色。那么如何使用字段集边框颜色。
<fieldset class="field_set">
<legend>box</legend>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
</tr>
</table>
</fieldset>
css
css
.field_set{
border-color:#F00;
}
回答by kennytm
It does appear red on Firefox and IE 8. But perhaps you need to change the border-style
too.
它在 Firefox 和 IE 8 上显示为红色。但也许您也需要更改border-style
。
.field_set{
border-color: #F00;
border-style: solid;
}
<fieldset class="field_set">
<legend>box</legend>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
</tr>
</table>
</fieldset>
回答by Pekka
回答by user1021860
I added it for all fieldsets with
我为所有字段集添加了它
fieldset {
border: 1px solid lightgray;
}
I didnt work if I set it separately using for example
如果我单独设置它,我没有工作,例如
border-color : red
边框颜色:红色
. Then a black line was drawn next to the red line.
. 然后在红线旁边画了一条黑线。
回答by mx0
If you don't want 3D border use:
如果您不想使用 3D 边框,请使用:
border:#f00 1px solid;