[thelist] <fieldset> and <legend> vs <h2>

Bill Moseley moseley at hank.org
Wed Jun 27 08:05:19 CDT 2007

On Wed, Jun 27, 2007 at 08:42:22AM -0400, Randal Rust wrote:
> In a situation like yours, I do something like this:
> <form>
> <h2>Basic Information</h2>
> <fieldset></fieldset>
> </form>

Does <fieldset> require <legend>?  I don't see it explicitly on
WC3, but I see:

    The content of a FIELDSET element must begin with a LEGEND to
    provide a caption for the group of controls.

at http://htmlhelp.com/reference/html40/forms/fieldset.html

For more complex forms that's what I do, although I think I do more
like this with the heading outside the form tag (for no reason other
than how my forms are auto-generated).

    <h2>Your Profile</h2>
            <legend>Personal Info</legend>
            <legend>Account Settings</legend>
            <legend>Medical Information</legend>

Which is the obvious usage.

> For the sake of consistency, you may want to have a heading before
> every FIELDSET, even if it only has one field.

I would agree.

Bill Moseley
moseley at hank.org

More information about the thelist mailing list