Solved

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

Posted on 2013-05-21
6
209 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
  • 2
  • 2
6 Comments
 
LVL 30

Expert Comment

by:LZ1
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

CSS is a visual language used to classify objects and define rules about how they should be displayed. CSS skills aren’t restricted to developers anymore, there is a big benefit to having a basic understanding of the language, regardless of your occ…
Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

763 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now