Do search engines treat text-indent:-9999em or neg

2019-05-30 04:11发布

问题:

I want to use a technique like text-indent:-9999em or negative margin to replace my text with more pretty pictures, but I wonder if search engines would treat this as kinds of cheating?

I think for it to know this, it must read my CSS file, so I can use robots.txt to forbid it from reading my CSS file. If this works, can I also use display:none directly? Or I can manipulate some web-element's style by using jQuery code?

回答1:

The techniques you have outlined (negative margins/indents) etc are common practices.

As long as you're not introducing spammy links/text using these methods then you'll be OK - it's all about intent. Google has stated (via mouthpiece Matt Cutts in a webmaster video) that you should try to avoid this approach if possible and use traditional alternate text for inline images etc.

There are a number of different text/image replacement techniques floating around, each with different UI/UX/SEO impacts that you'll need to consider. I'd recommend this resource as a starting point (bonus - there's a link to a 'Google impact' post): http://mezzoblue.com/tests/revised-image-replacement/



回答2:

This shouldn't be a problem: as others have said in their answers, this sort of technique has been so widely used by web developers for image replacement that it's highly unlikely to be treated as cheating by search engines.

However, it's worth noting that the use of massive text-indents (like -9999em) is now known to cause performance problems because it requires the browser to draw a huge box around every element that uses this technique. For some better, cleaner ways of achieving the same effect, see my answer to this question.



回答3:

For Friendly CSS Hiding contents without affect SEO, it's recommended to do it like below:

.divToHide{
    position:absolute;
    top:-9999;
    left:-9999;
}

I'm using it in my site, you can see css-tricks site for more information



回答4:

ok, you can hide text (with css text indent, with display none, no need to block the css) and it is ok for google as long as it is not misleading / spammy. but if you have a lot more hidden text on a page then visible text then this is not a good quality signal. your site (if it is in any way important / eligible to some google traffic) will then probably get flagged and visited by a human quality reviewer (which is not a big thing if your site is otherwise ok).



回答5:

There's no clear right or wrong response on this from either Google, Yahoo! or Bing but, as Mike rightly put, this has been common practice by developers for a long time as a way of adding logos or custom headings where fonts have treatment not possible with CSS (think text style crisp in PhotoShop or with fonts that aren't licenced for @font-face use).

As long as it isn't heavily used across your site (stick to logos and headings not body copy) and the hidden text doesn't have excessive keywords you're likely to be ok. Take a look at google.co.uk and you'll see they hide the h1 on there with visibility: hidden;

An important thing to consider is accessibility. Accessible sites are more SEO friendly because the content is available to everyone. Would your site still be usable if someone had CSS turn on but images turned off? It's not an uncommon thing and, with mobile use increasing, people may do this to keep data costs down.