Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I define fieldset border color?

Tags:

html

css

border

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

css

.field_set{  border-color:#F00; } 
like image 560
Kali Charan Rajput Avatar asked Sep 18 '10 10:09

Kali Charan Rajput


People also ask

How do you put a border on a Fieldset in HTML?

fieldset border: 1px solid #888; border-right: 1px solid #666; border-bottom: 1px solid #666; 19. fieldset border: 3px solid rgb(234, 234, 234);

How do you color code a border in HTML?

Definition and Usage This property can take from one to four values: One value, like: p {border-color: red} - all four borders will be red. Two values, like: p {border-color: red transparent} - top and bottom border will be red, left and right border will be transparent.

Is it possible to style a border for different colors?

You can use the border-image property to create a gradient border with 4 colors.


2 Answers

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

like image 125
kennytm Avatar answered Oct 20 '22 04:10

kennytm


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.

like image 44
Pekka Avatar answered Oct 20 '22 04:10

Pekka