Solved

Need a sprite technique that won't conflict with Google guidelines

Posted on 2013-05-21
6
217 Views
Last Modified: 2013-09-20
Right now I am doing buttons and some graphics like this:

Put the buttons in a sprite image.

<a class="button" href="mylink.aspx"><span>Button text</span></a>

css:
.button
{
background: url(mybuttonimg) 0px 0px no-repeat;
display: inline-block;
height: 20px;
width: 20px;
}
.button:hover
{
background-position: 0px -30px;
}
.button span
{
position: absolute;
top: -999em;
}

However I found out that positioning the text off the page will hurt our Google rankings.

So, is anyone aware of a good technique that will still let me fetch all the buttons as one image but not violate the Google guidelines? Maybe with Javascript?

And we still want the button text, probably  as an image alt tag
0
Comment
Question by:EndeavorToPersevere
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
6 Comments
 
LVL 30

Expert Comment

by:LZ1
ID: 39185747
So is your text for the button inside the image itself? Can you post an image of your button?
0
 
LVL 2

Author Comment

by:EndeavorToPersevere
ID: 39185851
We do this all over the site but for example, here is a download button
download button sprite
The html that uses this button is
<a class="download" href="/Downloads.aspx">
<span>Download</span>
</a>

the css is
.download {
background: url(myfile.png) 0px 0px no-repeat
display: inline block;
height: 30px;
width: 124px;
}
.download:hover
{
background-position: 0px -40px;
}
.download span
{
position: absolute;
top: -999em;
}
0
 
LVL 30

Accepted Solution

by:
LZ1 earned 500 total points
ID: 39187294
In that case I personally wouldn't put the text inside the <a>. I would use alt and title for the a tag and leave the text out entirely.

Although I am aware that Google doesn't necessarily like hidden or severely indented text. However, are all of the words you would be hiding  that important to your SEO campaign?
0
 
LVL 2

Author Comment

by:EndeavorToPersevere
ID: 39204637
The words themselves aren't important. I'm just trying to balance looking good, not getting penalized overall for hiding text and accessibility.

Thanks for the suggestion
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
Suggested Courses

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question