How do I place block elements in the HTML paragraph tag? When I attempt to do that, Firebug's HTML tab shows that the paragraph does not enclose the block element. Furthermore, any CSS applied to the paragraph does not apply to the child block element.
This code:
<p>
<ol>
<li>foo</li>
<li>bar</li>
</ol>
</p>
p {
line-height: 2em;
}
Becomes rendered as:
<p></p>
<ol>
<li>foo</li>
<li>bar</li>
</ol>
From http://www.w3.org/TR/html401/struct/text.html:
The P element represents a paragraph. It cannot contain block-level elements (including P itself).
List tags are not supposed to be enclosed in a paragraph tag. What are you trying to do?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With