Reputation: 3485
I put a div with display:inline-block
inside a <p></p>
. The div clears the left. But if I put it in a <div></div>
, it follows the flow.
fiddle: http://jsfiddle.net/jDBxN/
Anyone know why? How to make <p>
with inline-block
behaves the same as <div>
?
Browser is Chrome 29
Upvotes: 2
Views: 6846
Reputation: 157324
Your HTML is invalid, you cannot nest a block level element inside p
tag, consider using span
instead
If you want, you can also nest a p
tag inside div
but the text will lose it's meaning, so better use p
and nest span
inside p
.
From the Spec: Resource
The P element represents a paragraph. It cannot contain block-level elements (including P itself).
Upvotes: 5