Is it ok to put a link and an image inside an h1?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With