将<img/>和<a> tags into a <p> tag?

时间:2018-10-17 12:51:46

标签: html

What I am trying to do is have a <p> element with the title of an image on the first line and a <p> element that contains "by + the image of the author + the name of the author". The problem is that I'm not sure putting an <img> tag + <a> tag into the <p> tag is correct.

The bare bone of what I'm trying to do is this:

<p>Title<p>
<p>
    by <img src='#'><a href='#'>Author</a>
</p>

1 个答案:

答案 0 :(得分:2)

根据HTML5规范,<p> element应该包含phrasing content。它还说<a><img>确实是措辞内容。

是的,这样做很好,并且完全有效。