Hiding <fieldset> Borders

First published on 2008-02-05, updated on 2008-03-12.

The borders and spacing of the <fieldset> element rarely suit a design. This removes them:

/* Forms */
form, fieldset, legend {
 margin: 0;
 padding: 0;
 border: 0;
}

Setting margin and padding for <form>, <fieldset> and <legend> ensures you override all default spacing. This improves cross-browser consistency.

Styling the <legend>

A notorious trouble spot, styling the <legend> element gets its own article.