Should I use font-size: 0 for image links?
When styling a link with a background image, where the link has text in it which is replaced with text in the image, is it OK SEO-wise to set the font-size to 0 to avoid the text being over the image?
Like this:
<a href="htp://g开发者_StackOverflowoogle.com" title="Google, the Best Search Engine!" class="googleLink"> Google </a>
<style>
.googleLink {
display: block; height: 40px; width: 40px;
background: url('googleLinkImage-40x40.png') no-repeat;
font-size: 0;
}
<style>
I understand font size 0 is bad if you're abusing it to hide keywords, but does this technique hurt SEO when used sincerely?.
Thanks.
When it comes to SEO, no-one really knows what's good or not, because neither Google nor Microsoft actually tell anyone exactly how things affect your rankings.
SEO "experts" like to watch Google and Bing, etc and try to see what effect different techniques have; they can see what sites get good rankings, and look at those sites to see what they're doing differently to those around them.
The really good SEO experts can actually do quite well at working out some of the key things to do to make a difference. But most of the so called "experts" are really just repeating things they've heard other people saying.
The one really important thing to know is that no matter what works well now, you need to also consider what will work in the future.
Google in particular have been known to adjust their algorithms very deliberately to punish SEO techniques that they consider to be "cheating". Sneaky tricks that were successfully getting sites to the top of the list suddenly changed into causing them to disappear into oblivion.
My advice therefore is as follows: I can't tell you whether this specific trick will or will not help your SEO score. I don't claim to be an expert in the field. But I will say that any time it feels like you're being sneaky in order to gain SEO points, it's likely to be a short-term gain at best, and there's a good chance it'll actually cause problems for you later on.
So if you think this feels like a sneaky trick that Google might take offence to, then you might want to think twice about it. Would a title
attribute not be sufficient? (they're great for SEO, apparently)
On the other hand, if it feels to you like a legitimate way of hiding text which you want to be in the page content but not displayed, then go ahead with it.
As yourself: What would Google do? ;-)
The important thing here is using your alt tag attribute for SEO, Google recommends it this way.
Having said that there are several css techniques for this. The one i recommend one is using text-indent: -99999em;
instead of decresing the font-size
.
精彩评论