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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:54:44+00:00 2026-06-13T18:54:44+00:00

I have created a css sprite image for multiple images. The css for sprite

  • 0

I have created a css sprite image for multiple images. The css for sprite is:

.sprites {background-image:url("/images/max.png");background-color:transparent;background-repeat:no-repeat;}#image_5306605314403955_gif {height:10px;width:10px;background-position:0 0;}#image_2814089791124994_gif {height:8px;width:8px;background-position:-10px 0;}#image_05699283026450497_gif {height:36px;width:50px;background-position:-18px 0;}#image_23591702358881883_gif {height:9px;width:11px;background-position:-68px 0;}#image_9167572062810537_gif {height:10px;width:10px;background-position:-79px 0;}#image_21043553959746242_gif {height:16px;width:16px;background-position:-89px 0;}

Now I want to assign the first image from this sprite to an li element. Currently the first images is assigned using background:url property of this li as:

li{margin-top:0;padding:3px 0 3px 25px;background:url(../images/arrow.gif) 

How can bring the first image from sprite and assign to the li element. I have seen an example which suggests to use:

<div class="sprites" id="image_5306605314403955_gif"></div>

But I want to see if adding HTML can be avoided and use CSS only for that purpose. The li element on my page looks like:

<li><a href="http://www.xyz.com">ABC</a></li>
  • 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-06-13T18:54:45+00:00Added an answer on June 13, 2026 at 6:54 pm

    I am not sure if that is what you are looking for or not, but the below code should do it:

    HTML:

    <li class="sprites"><a id="image_5306605314403955_gif" href="http://www.xyz.com">ABC</a></li>
    <li class="sprites"><a id="#image_9167572062810537_gif" href="http://www.xyz.com">ABC</a></li>
    

    CSS:

    .sprites {background-image:url("/images/max.png");background-color:transparent;background-repeat:no-repeat;}
    #image_5306605314403955_gif {height:10px;width:10px;background-position:0 0;}
    #image_2814089791124994_gif {height:8px;width:8px;background-position:-10px 0;}
    #image_05699283026450497_gif {height:36px;width:50px;background-position:-18px 0;}
    #image_23591702358881883_gif {height:9px;width:11px;background-position:-68px 0;}
    #image_9167572062810537_gif {height:10px;width:10px;background-position:-79px 0;}
    #image_21043553959746242_gif {height:16px;width:16px;background-position:-89px 0;}
    

    If what you are looking for is not to use class or id, then I think it is impossible, as your CSS needs an identifier to differentiate between your items (which are inherited from the same class <li>)

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

Sidebar

Related Questions

I have created a button CSS class that uses background images with different positions
I've created an image which is basically a CSS sprite of 3 images together.
I have created a CSS class as follows: div.ycontent div.ppclisting { background-color:#cccccc; } div.ycontent
I have a background image to be used for CSS sprite Now the issue
I have 3 different images and want to create a sprite using CSS. I
I have a question regarding image alignment with CSS. For example I have created
So, I'm looking to do a background image in CSS using a sprite sheet.
Ok...so here is the problem. I have a CSS sprite image made up of
I have 3 CSS functions for sprites and I created a link with them.
I have created a css gradient.Am trying to place a image above that.Below is

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.