I'm writing example code for everything in HTML and CSS. I came across display:inline
and wrote a few snippets to explain how a naturally block level element (<div>
) would function as an inline element. In recent studies, I've found that modern browsers will automatically escape a <p>
tag when it comes across a <div>
within a <p>
.
My JSFiddle example you can view here shows this in action. If you inspect the <p>
element, you'll find that the <div>
is no-longer inside of the paragraph. I'd like to know why, as the <div>
should be treated as an inline element.
Thanks!
` tag. I feel your answer is the most thorough explanation. CSS may control the 'display' of HTML, though it is not changing what the elements 'are'. Thank you, and everyone else, who took the time to answer.
– Akaishen Feb 13 '12 at 04:27