Table of Contents

FIELDSET/LEGEND in XHTML vs. HTML

Posted 2005-06-01 @ 02:04:46

Here's a subtle difference between HTML & XHTML that's not mentioned on the W3C's list: LEGEND is a required child of the FIELDSET element in HTML 4.01, but not XHTML 1.0:

From the HTML 4.01 Strict DTD:

<!ELEMENT FIELDSET - - (#PCDATA,LEGEND,(%flow;)*) -- form control group -->

And, the corresponding entry for XHTML:

<!ELEMENT fieldset (#PCDATA | legend | %block; | form | %inline; | %misc;)*>

I put together simple test cases, and sure enough, the validator fails HTML version.