[whatwg] <p> elements containing other block-level elements

Anne van Kesteren fora at annevankesteren.nl
Thu Apr 7 00:13:11 PDT 2005


Ian Hickson wrote:
> One thing that XHTML2 does which makes a lot of sense to me is allow 
> nesting of certain elements within <p> elements, as in:
> 
>    <p>
>     For this recipe you need
>     <ul>
>      <li>an egg,</li>
>      <li>flour, and</li>
>      <li>butter.</li>
>     </ul>
>     Mix it all together and so forth.
>    </p>

The problem is that you mix inline with block-level. Unless UL is 
redefined to be inline level within P I don't think this is a good idea. 
I like the idea of having either inline or block-level content.


> Other elements that I could see being nested inside a paragraph are:
> 
>   * <ol>
>   * <ul>
>   * <dl>
>   * <menu>
>   * <table>

I can agree with these, although I wonder about MENU.


>   * <pre> 

We have CODE and other nice inline elements for this.


> I think the following should be allowed:
> 
>   <p>
>    ...
>    <table>
>     <tr>
>      <td>
>       <p>...</p>
>      </td>
>     </tr>
>    </table>
>   </p>

That is indirectly nesting P elements, a bit ugly IMHO. It also doesn't 
make sense.


>   <p>
>    ...
>    <ol>
>     <li>...</li>
>    </ol>
>   </p>

If OL is an inline element here, sure.


>   <ol>
>    <li>
>     <p>
>      ...
>      <ol>
>       <li>
>        ...

Why would you want a P element there?


>   <pre>
>    <p>...</p>
>    <p>...</p>
>   </pre>

Ouch! Forbid this.


>   <p>
>    ...
>    <pre>...</pre>
>   </p>

Use case?


> I think the following should not:

Agreed with all examples.


-- 
  Anne van Kesteren
  <http://annevankesteren.nl/>




More information about the whatwg mailing list