Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7693117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T21:00:40+00:00 2026-05-31T21:00:40+00:00

I have some 10 buttons with image-text and hover states for each. What I

  • 0

I have some 10 buttons with image-text and hover states for each.
What I want to do is use background-position, width and height to only show the part of the background image sprite and hover background-position to show the hover style.
I’ll also use an image replacement class on the element so that it remains accessible and indexable.

So (measurements are random):

[CSS]

.menu{background-image:url(path/to/sprite.png);}
.button-1{width:200px;height:30px;background-position:0 0;}
.button-1:hover{background-position:0 -30px;}
.button-2{width:250px;height:30px;background-position:100px 0;}
.button-2:hover{background-position:100px -30px;}
/* Image Replacement Class (H5BP, @necolas && BEM) */
.ir{border:0;font:0/0 a;text-shadow:none;color:transparent;background-color:transparent;}

[HTML]

<a href="someLink.html" class="menu button-1 ir">Button 1</a>
<a href="someOtherLink.html" class="menu button-2 ir">Button 2</a>

What I want to know is if that is a good way of doing this or should it be done differently, like:

<a href="someLink.html"><img src="image.png" width="200" height="30" alt="Button 1"/></a>

Then with JavaScript swap the image on hover.

Is there any difference between the two in terms of accessibility and robots?

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T21:00:42+00:00Added an answer on May 31, 2026 at 9:00 pm

    What you are doing is correct. Do not forget to add a display: block; to that link. Something else you can do is putting the actual link text in a span and then positioning that span absolute out of the screen. Like so:

    <a href="" title="Test link"><span>Home page</span></a>
    

    And in your css file:

    a > span {position: absolute; top: -10000px;}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What should I use if I want to have buttons on an image? I
I've some CSS problem in Firefox 3. I have several image buttons on my
I have a CALayer with some image contents. When a button touched, I want
I have some 10 buttons with different names each.On selecting each button I need
I am trying to create a rich text editor. I have created some buttons
I want to design a TableLayout with some big buttons with icon and text
Well I have two buttons, each image in a span, and one should be
I have some buttons in an UIView. My problem is, that they get cut
I have some filter and one grid.And grid have some buttons like modify/edit.I am
In my application I have some link buttons there but when I right click

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.