Are divs in a fieldset valid?

I’m using a 4.01 strict dtd.

Some sources I read say divs in a fieldset are not valid. Or do they mean, specifically a div can’t be the first child element, because a legend needs to be the first child?

So is this valid:


<fieldset>
            <legend>Shipping Information</legend>
        <div>
        <label for="name">Name:</label>
        <input type="text" id="name" name="name" />
        </div>
 </fieldset>

?

In a word, yes. The fieldset may contain anything a div may hold, plus the legend element.

See Forms in html documents, §17.10 Adding structure to forms: the FIELDSET and LEGEND elements.

N.B. It is a Good Thing® to learn to read the specs.

cheers,

gary

fieldsets can contain block level elements…a div is a block level element so yes…fieldsets can contain divs and other block level elements…check out xhtml.com…they have a section that shows what an element can contain