Re: Using <p> elements purely as containers of phrasing elements? Semantic or not?

There is another concern which makes me rethink whether <p> element is
really an ideal choice for thematically grouping form controls.

Sometimes we may want to put a paragraph of text after an <input>
element to describe something. However, using <p> element to group
form controls doesn't allow us to do that because <p> elements cannot
wrap <p> elements. Like the following invalid example.

<p>
    <label for="name">
    <input id="name" type="text">
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Maecenas laoreet imperdiet diam, in sodales velit porta eget. Ut
tellus urna, vestibulum vel facilisis eu, blandit sed est.</p>
</p>

And it's possible that form validation javascript functions insert
error messages (<p>) after form controls. If <p> elements is the
container, CSS issues might occur because the <p> element (container)
contains <p> element (error messages).

Base on the above considerations, it's worth rethinking if using <p>
element for thematically grouping for form controls is a correct
approach.


Kind Regards,
Ian Yang

Received on Tuesday, 7 May 2013 11:17:20 UTC