What's the correct way to hide the

tag and not be banned from Google?

前端 未结 10 1338
予麋鹿
予麋鹿 2021-02-07 00:54

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

Something.com | The best something ever

10条回答
  •  醉酒成梦
    2021-02-07 01:00

    set the image as the background of your h1 (set the width/height so it fits) then set your text-indent to something crazy like -9999px. That way when css is disabled (such as being crawled) the bot will see the text in the header instead of the background.

    example:

    CSS

    #myHeader {
    width:200px;
    height:50px;
    background: url('lcoation/of/the/image.jpg') top left no-repeat;
    text-indent:-9999px;
    }
    

    HTML

    
    ...
    

    HELLO WORLD

    ...

提交回复
热议问题