Using a H1 logo in HTML5

亡梦爱人 提交于 2019-12-01 23:16:57
Jeff Watkins

Most of the time, you'd want to wrap the image in an anchor, which also has a title... See This answer and This answer.

Maybe they were just nervous about the lack of a proper anchor? The img tag is entirely legitimate.

unor

Yes, you can have an img element as content of an h1 element.
Yes, it makes sense to have the img-logo as h1 (in case it belongs to the body sectioning root, like it does in your example).

If your site doesn’t show a separate textual name, you definitely should do this. Otherwise, the document outline could be wrong (if you don’t use sectioning elements wherever needed) or at least the outline would have an unlabeled top-level entry, which is not very user friendly/accessible.

If you have a site logo and a textual site name, it’s discussible: either include the img together with the text in the same h1, or have only one of these elements in h1 (either one is possible) and have the other one as "alternative title", e.g., together in a header element.

For examples, see some of my related answers on SO (1, 2, 3) and Code Review (1, 2, 3).

(Your "SEO expert" is not the only one having a problem with this, as you can see in some of the comments to my linked answers. I have yet to see an argument against it ….)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!