Is it ok to put a link and an image inside an h开发者_运维知识库1?
SEO wise, it makes sense but I'm debating whether its correct semantically and in regard of standards compliance.
Example
<h1>
<a href="example.com" title="link to example.com">
<img src="img.png" alt="example logo" />
Example.com
</a>
</h1>
Yes.
An h1
tag is allowed to contain "phrasing content". This means "phrasing elements intermixed with normal character data". a
and img
tags are both phrasing elements.
精彩评论