Is it valid to put a fieldset element outside of a form element?


I want to use it around previous answers to questions in a wizard type entry system. e.g. Step 1, the user enters demographics, Step 2. The user enters something else, but next to the form is the information previously entered in Step 1.

3 answers


Absolutely. XHTML will still validate and browsers will still render the fieldset properly.

Answered about 10 years ago by Jeremy Orion
Dom 15

The code would still be valid as the user above said but it would be semantically incorrect. The fieldset tag is used to group together a set of elements in a form tag.

I.E. you would wrap a fieldset around a group of elements that are collecting personal details and then give that fieldset a legend of Personal Details.

Answered about 10 years ago by Dom

If you want valid and semantic, just wrap your previous answers in a div and apply CSS to make it look like a fieldset.


div.like_fieldset { 
    margin: 14px auto;  
    border: 1px solid #9DB8B8;
    height: auto; 
    clear: both; 
    width: 90%;

div.like_fieldset {
    text-align: center;

div.like_fieldset p,
div.like_fieldset h3 {
    text-align: left; 
    clear: left;

p.like_legend {
    font: 0.85em Verdana, Geneva, Arial, Helvetica, sans-serif;
    background-color: #fff;
    margin: -1.6em 0 0 0.1em;
    padding: 0.2em;
    float: left;
    height: 1.5em;
    position: relative;
    display: inline;
Answered about 10 years ago by Tony Crockford