RE: OT - valid HTML question

Jon Hanna wrote:

> Form can only directly contain a block element, hence you need
> to have a block element that can contain inline (<p>, <div>, 
> <td> etc.) in the form and the <input /> or whatever inside that.

Yes, so the fields need not be included into <p> elements; other block
elements will do, syntactically at least.

The principle that inline (text level) elements need to be wrapped inside
block level containers (in HTML 4 Strict) is a relatively old one. Even the
HTML 2.0 specification contained a "Strict Level 1 HTML DTD", where a <body>
element must not directly contain inline elements.

What does it matter? Well, from the accessibility point of view, it is very
natural to group e.g. an input field and the associated label inside a
<div>, especially since it's normally best that they appear on a line of
their own. And this automatically puts them inside a block level container.
Such constructs might be _additionally_ grouped inside enclosing <div> or
other elements, such as <fieldset>.

I'd say that normally <p> is not the logical markup to use inside a <form>
except for longish explanations (instructions). A label/field pair is not
really a paragraph, and neither is a collection of such pairs.

-- 
Jukka Korpela, senior adviser 
TIEKE Finnish Information Society Development Centre
http://www.tieke.fi/
Diffuse Business Guide to Web Accessibility and Design for All:
http://www.diffuse.org/accessibility.html

Received on Tuesday, 12 November 2002 15:25:17 UTC