From the fine specification:
p – paragraph
[...]
Permitted contents
Phrasing content
And what is this Phrasing content? Phrasing content:
Consists of phrasing elements intermixed with normal character data.
Normal character data is just that: unmarked up text. Phrasing elements are:
a or em or strong ... [a bunch of other elements none of which are div]
So,
is not valid HTML. Per the tag omission rules listed in the spec, the
tag is automatically closed by the
tag, which leaves the
tag without a matching
. The browser is well within its rights to attempt to correct it by adding an open
tag after the
:
You can't put a inside a
and get consistent results from various browsers. Provide the browsers with valid HTML and they will behave better.
You can put inside a
though so if you replace your
with
and style it appropriately, you can get what you want.
Your reference at about.com disagrees with the specification at w3.org, your reference is misleading you.