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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:58:56+00:00 2026-05-27T17:58:56+00:00

May be this seems silly question for you guys.. Its about CSS Sprites. I

  • 0

May be this seems silly question for you guys.. Its about CSS Sprites. I have a navigation which contains 4 menus like.. HOME COMPANY SERVICES SUPPORT although I used a css sprite that have 3 mode/state for static, hover and selected(class called ‘current’). I used to call them like..

ul#top-nav-links {list-style:none; background:url(../images/nav-bg.png) no-repeat scroll 0 0; width:508px; height:35px; float:left; margin-left:80px; margin-top:33px; padding-left:4px; margin-right:23px;}
ul#top-nav-links li{float:left; position:relative; z-index:99999;}
ul#top-nav-links li a.home01{background:url(../images/nav.png) no-repeat scroll 0 0; display:block; width:100px; height:31px; text-indent:-999px; float:left;}
ul#top-nav-links li a.company01{background:url(../images/nav.png) no-repeat scroll 0 0; display:block; width:150px; height:31px; text-indent:-999px; float:left; background-position:-100px 0px;}
ul#top-nav-links li a.services01{background:url(../images/nav.png) no-repeat scroll 0 0; display:block; width:140px; height:31px; text-indent:-999px; float:left; background-position:-250px 0px;}
ul#top-nav-links li a.support01{background:url(../images/nav.png) no-repeat scroll 0 0; display:block; width:115px; height:31px; text-indent:-999px; float:left; background-position:-390px 0px;}

ul#top-nav-links li a.current{background:url(../images/nav.png) no-repeat scroll 0 -62px; display:block; width:100px; height:31px; text-indent:-999px; float:left;} 

and here is the image I used enter image description here

so I need to display the middle colored one on hover state, although the last one for the current state, of course the current state wasn’t need hover effect..

I know, It should call like this..

ul#top-nav-links li a.company01:hover{background-position:-100px -31px;}

but I curious if somehow that code should be shortened by avoiding to call each menu as separate instead like this…

ul#top-nav-links li a:hover(background-position:0px -31px;}

the above one I tried but the horizontal positioning of the image wasn’t possible..

Any thoughts?

drop down a comment, if this question was confused.. 🙂

  • 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-27T17:58:57+00:00Added an answer on May 27, 2026 at 5:58 pm

    I’m not positive about cross-browser support, but this at least works in Chrome 15.

    http://jsfiddle.net/tkZMB/

    li:hover {
        background-position-y: -31px;
    }
    

    You could combine this to simplify your overall CSS too.

    /* General list item declaration */
    li { 
        width: 130px; 
        height: 30px; 
        border: 1px solid gray; 
        float: left;
        background: url(https://i.stack.imgur.com/m5HOI.png);
    }
    
    /* For each child move menu over */    
    li:nth-child(2) {
        background-position-x: -100px;
    }
    
    /* On hover slide the background up. */
    li:hover {
        background-position-y: -62px;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This may seem a very silly question. Consider this: I have a simple Boolean
This may seem like a silly question. We have a streaming server and the
This may seem a rather silly question, but I have a header file for
This may seem like a silly question if so sorry =] Ok i have
This may seems a silly question for Java developers, however, I'm new to Java,
This may seem like a silly question but I can't figure it out. let's
Now this may seem like a silly question, but I need to know how
This may seem like a daft question, but i was wondering about how to
This may seem like a silly question but I can't find anything to help.
This may seem like a silly question, but do custom fonts that are linked

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.