What's the correct way to hide the

tag an

2019-03-23 11:04发布

The website I am working on uses an image defined in CSS as the main logo. The html code looks like this:

<h1>Something.com | The best something ever</h1>

I would like to display just the image defined in CSS and pass the information from the h1 tag to the search enginges only.

What's the correct way to do this? Google is very strict about this, I know that display:none is wrong, what about visibility: hidden ?

Thanks in advance!

标签: html css seo
10条回答
看我几分像从前
2楼-- · 2019-03-23 11:56

A full article in this matter is explained here https://www.paciellogroup.com/blog/2012/05/html5-accessibility-chops-hidden-and-aria-hidden/ So , when i work i use this code to support screen reader as well as hide some h1's and use pictures instead of it like (logo)

.offscreen{
  position: absolute;
  clip: rect(1px 1px 1px 1px); /* for Internet Explorer */
  clip: rect(1px, 1px, 1px, 1px);
  padding: 0;
  border: 0;
  height: 1px;
  width: 1px;
  overflow: hidden;
}

to find more follow the link

查看更多
爷的心禁止访问
3楼-- · 2019-03-23 11:58

The "correct" way to do this is to have the text in the title bar or in your page's meta text.

查看更多
爷、活的狠高调
4楼-- · 2019-03-23 11:58
<h1 style="font-size: 0px; margin: 0px;">Something goes here</h1>

Works like a charm.... ;-)

查看更多
叛逆
5楼-- · 2019-03-23 12:01

The easiest, foolproof, best for SEO solution would be

<h1><img src=logo.png alt="Something.com | The best something ever"></h1>
查看更多
登录 后发表回答