tags:

views:

292

answers:

8

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!

A: 

I think that visibility: hidden; would work fine. Have you tried it yet?

William Hand
+1  A: 

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

<body>
...
<h1 id='myHeader'>HELLO WORLD</h1>
...
</body>
cdutson
Some search engines will ignore text that is very obviously indented off the page. You could play it safer by using a smaller text-indent and combining it with `overflow:hidden`. Something like `text-indent:-100em` is often enough.
meagar
Yes, this is the way it's being done right now. The content of the <h1> tag is indented by -9999px and I'm not sure this is the right way to do it.
Martin Zahuta
yeah, you could drop the number down and use ems. It was a quick example, but yes that's a possible outcome using massively offset text. good point meagar.
cdutson
+3  A: 

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

me_and
Aren't meta texts largely ignored by search engines nowadays? At least for SEO purposes.
hgpc
@hgpc: Possibly, but it's not actively cheating, which most of the other methods discussed here are, and which will get you heavily down-ranked if detected.
me_and
+3  A: 

You should be fine with visibility: hidden.

That said, if your image is part of the content (and I would dare to say that a company logo is content, not presentation), and you care about accessible html, you should consider changing your code to include the image as a img element with title and alternate text, instead of a css background-image.

Additionally, if you hope the attract search engines to the keywords inside the <h1> element, you might want to include those words more than once in the page. The page title is a much more relevant place than the h1 element, for example.

hgpc
You're right. I will include the logo as an img element instead of a css background-image and use the title and alt properties.Thank you.
Martin Zahuta
A: 

Does your web site consist of just one single page?

Otherwise you should put the headline of each page in the h1 tag, not the tagline of the site. Repeating the same headline on every page would make it pretty much useless.

Guffa
+3  A: 

The easiest, foolproof, best for SEO solution would be

<h1><img src=logo.png alt="Something.com | The best something ever"></h1>
Ms2ger
A: 

Resizing the block would work:

h1 {
    overflow: hidden;
    width: 1px;
    height: 1px;
}
Chikiro
+1  A: 

You're not going to get good SEO results if you, first hide the h1, and second use generic phrases inside the h1.

Don't just use the h1 for sizing, you can use classes to style.

H1 tags should contain keyword rich information such as:

Automotive Repair

Automotive repair being the keyword that relates to the particular page I'm theoretically working on.

Hope that makes sense.

s_broderick
Most reasonable answer here. Don't try to cheat it coz it dont work.
Thqr