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
Solved

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

Posted on 2013-05-21
6
215 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
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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 receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
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…

861 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