[英]How can I define fieldset border color?
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.
我正在使用类,但这不能正常工作,因为我想删除fieldset默认边框颜色。 so how can I use fieldset border color.
那么我该如何使用fieldset边框颜色。
<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;
}
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>
It works for me when I define the complete border
property. 当我定义完整的
border
属性时,它适用于我。 (JSFiddle here ) (JSFiddle 这里 )
.field_set{
border: 1px #F00 solid;
}
the reason is the border-style
that is set to none
by default for fieldsets. 原因是默认情况下为fieldsets设置为
none
的border-style
。 You need to override that as well. 你也需要覆盖它。
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.
然后在红线旁边绘制一条黑线。
如果您不想使用3D边框:
border:#f00 1px solid;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.