The fieldset
and legend
elements are notorious for being tricky to style, especially if you want the same result across browsers. Other than the line wrapping issue I wrote about in How to line wrap text in legend elements, even in IE, you may run into problems and differences related to padding, backgrounds and positioning of the legend
element.
Recently I noticed more fieldset
+ legend
weirdness, this time involving the border-radius
and box-shadow
CSS properties. If you use either property on a fieldset
element that has a child legend
element (which all fieldset
elements should), you will get unexpected results in some browsers. Luckily I also found a fix after a bit of experimentation.
Posted in CSS.
Copyright © Roger Johansson