Quote:
Originally Posted by KevinH
A div is a block element and can not be inside a p element.
|
Although the HTML presented was malformed, HTML 5 and XHTML 1.1 have removed the "
p cannot contain a
div" restriction...both are semantically identical as far as document structure is concerned.
Except for user-agent stylesheet differences between
div and
p (like
p often having non-zero
margin-top and
margin-bottom), putting one inside the other generally renders the same, and doesn't generate a parsing error (Sigil's view accepts it fine).
Also,
div is only a block element by default (just like
p, so the following lines render identically on almost every platform:
Code:
<p>Testing <div style="display:inline">a div</div> inside a p</p>
<div>Testing <p style="display:inline">a p</p> inside a div</div>