How can I define fieldset border color?

前端 未结 4 1187
予麋鹿
予麋鹿 2020-12-28 12:38

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

相关标签:
4条回答
  • 2020-12-28 13:13

    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.

    0 讨论(0)
  • 2020-12-28 13:17

    If you don't want 3D border use:

    border:#f00 1px solid;
    
    0 讨论(0)
  • 2020-12-28 13:28

    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>&nbsp;</td>
        </tr>
      </table>
    </fieldset>

    alt text

    0 讨论(0)
  • 2020-12-28 13:30

    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.

    0 讨论(0)
提交回复
热议问题