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 7662821
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:54:00+00:00 2026-05-31T13:54:00+00:00

I have a sprite image for each list item (home, services and contact). I’m

  • 0

I have a sprite image for each list item (home, services and contact). I’m using CSS to move the position on hover. It works fine except I would like fade the transition instead of rapidly moving the position. I am trying to make it look like the button is being pushed in on hover. I would like to slow it down. I have been all day on this and not getting anywhere. Thanks for any help!

HTML

<ul id="navigation">
<li class="link1"><a href="index.html">Home</a></li>
<li class="link2"><a href="services.html">Services</a></li>
<li class="link3"><a href="contact.html">Contact</a></li>
</ul>

CSS

li.link1 {
text-indent: -9999px;
background-image: url(../images/home.png);
background-repeat: no-repeat;
height: 15px;
width: 66px;
background-position: left top;
}
li.link1:hover {
background-image: url(../images/home.png);
background-repeat: no-repeat;
height: 15px;
width: 66px;
background-position: left bottom;   
}
li.link2 {

Repeats itself...
  • 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-31T13:54:01+00:00Added an answer on May 31, 2026 at 1:54 pm

    Could you do it with relative positioning and CSS3 transitions?

    li.link1 {
        position: relative;
        text-indent: -9999px;
        background-image: url(http://www.rjdesigns.net/temp/images/home.png);
        background-repeat: no-repeat;
        height: 15px;
        width: 66px;
    
         transition: margin 0.25s;
         -moz-transition: margin 0.25s; /* Firefox 4 */
         -webkit-transition: margin 0.25s; /* Safari and Chrome */
         -o-transition: margin 0.25s; /* Opera */
    }
    
    li.link1:hover {
        background-position: left bottom;
    
        // These lines add height to the top of the li, so it doesn't 
        // glitch/vibrate if you hover on the top pixel or two
        border-top: 2px solid transparent;
        top: -2px;
    
        // Increase margin by 2px on top and left
        // Decrease by 2px on right so you don't shift other menu items
        margin: 2px -2px 0 22px !important;
    }
    

    Demo:
    http://jsfiddle.net/jtbowden/gP9kD/

    Update Demo with all three links and simplified CSS for the li elements:
    http://jsfiddle.net/jtbowden/gP9kD/1/

    jQuery

    If you want a true fade effect, you can do this with jQuery. I hacked together an example here:

    http://jsfiddle.net/jtbowden/gP9kD/4/

    This example creates clones of each li changes the background-positioning, and absolutely positions them under the current li elements and hides them. Then on hover, it fades the main li out (to almost zero, so it still stays active), and fades in the one underneath.

    It is a little hacky, because the li clones still contain the link, etc. But it works, and demonstrates the principle.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a logo link that's using a background-image (css sprite). All works fine,
I have emoticons in a css sprite image that I want to display within
I have a CSS image sprite and this renderes perfect in FF, also IE.
I need to select each list item and change the background image of the
I have a sprite sheet which has each image centered in a 32x32 cell.
http://jsfiddle.net/jasondavis/Mt87G/1/ I am trying to do an un-ordered list, each list item will have
I have a sprite sheet and I want to display images next to each
I have a sprite image set as the background of an element on my
I have an image sprite of sorts with multiple frames for 1 button. I'm
I am trying to create a very basic sprite image. First off i have

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.