View Single Post
Old 08-23-2023, 12:36 PM   #7
nabsltd
Fanatic
nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.
 
Posts: 528
Karma: 9529956
Join Date: Aug 2013
Location: Hamden, CT
Device: Kindle Paperwhite (11th gen), Scribe, Kindle 4 Touch
Quote:
Originally Posted by KevinH View Post
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>
nabsltd is offline   Reply With Quote