body {font-size: 40px;}
p {font-size: 12px;}
div, span {font-size: 20px;}
<h6>Why font size of before is inherited from p, while that of after is inherited from div</h6>
<p>before<div>content</div>after</p>
<hr>
<h6>This result is acceptable</h6>
<p>before<span>content</span>after</p>
before
- what did you think
before meant in HTML? An empty p followed by an orphaned "before" text node? (The "after
" is [another story](http://stackoverflow.com/questions/11570902/why-does-a-stray-p-end-tag-generate-an-empty-paragraph).) – BoltClock Apr 03 '16 at 09:55