Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it ok to put a link <a> and an image <img> inside an h1 <h1>?

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>
like image 969
iancrowther Avatar asked May 21 '11 10:05

iancrowther


1 Answers

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.

like image 99
lonesomeday Avatar answered Nov 26 '22 14:11

lonesomeday