September 10, 2006

There are two tags I learned about for using with forms but never really knew they existed - <fieldset> <fieldset> and <legend> </legend>. They would be used for grouping fields within a form together - the fields may be street, city, state, and zipcode and would be contained within the fieldset tag. The legend tag would then contain text reading "Address". This resulted in those fields being surrounded by one big box with Address being in the upper-left corner of the box. I had seen it done before, but never gave it a second thought.

Fieldset and legend need not be limited to forms, however. It could be used to contain a set of instructions or an error message, like so:

<fieldset><legend>Error</legend>This page no longer exists. If you believe this is in error, please contact the webmaster.</fieldset>

becomes:

Error

This page no longer exists. If you believe this is in error, please contact the webmaster.