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. so how can I use fieldset border color.
<fieldset class="field_set">
<legend>box</legend>
开发者_Go百科 <table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
</tr>
</table>
</fieldset>
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.
.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. (JSFiddle here)
.field_set{
border: 1px #F00 solid;
}
the reason is the border-style
that is set to none
by default for fieldsets. 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.
If you don't want 3D border use:
border:#f00 1px solid;
精彩评论