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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T10:35:38+00:00 2026-05-18T10:35:38+00:00

I am a great lover of sprites, but. Got thinking, I do everything long

  • 0

I am a great lover of sprites, but. Got thinking, I do everything long hand, so was wondering if there was a shortcut.

Essentially, creating a sprite is easy. Making the sprite work is easy, but doing lots of sprites, gets laborious.

So was wondering what is the cleanest way of doing multiple sprites, that I can position anywhere on our web pages. I have seen multiple sprite sheets, similar to jquery ui icons, but we have our own icons. So was wondering if there was a cleaner method.

All up we will have approx 16 to 20 sprites in the set. Below is sample of html and css.

#logo-link
{
    width:32px;
    height:32px;
    text-decoration:none;
    display:block;
    background-image:url(sprites/analytics.png);
    background-position:0 32px;
}
#logo-link:hover,#logo-link:active  { background-position:0 0; }

#logo-link2
{
    width:32px;
    height:32px;
    text-decoration:none;
    display:block;
    background-image:url(sprites/addlisting.png);
    background-position:0 32px;
}
#logo-link2:hover,#logo-link2:active    { background-position:0 0; }

html

<a href="link1.html" id="logo-link"> </a>

<a href="link2.html" id="logo-link2"> </a>

Any thoughts, on refining our sprites. Or should we create a sprite sheet with all sprites on ?

Image sample:

alt text
alt text

Added basic sprite sheet on x axis

alt text

Example:

alt text

Ok Guys:

So far I have this in css:

.sprite
{
    width:32px;
    height:32px;
    text-decoration:none;
    display:block;
    background-image:url(sprites/spritesheet.png);
}

.addlisting{background-position:0 32;}
.addlisting:hover{background-position:0 0;}
.addanalytics{background-position:64 32;}
.addanalytics:hover{background-position:64 0;}
.addprofile{background-position:32 32;}
.addprofile:hover{background-position:32 0;}

html I have:

<a href="link2.html" class="sprite addlisting"> </a>

<a href="link2.html" class="sprite addanalytics"> </a>

<a href="link2.html" class="sprite addprofile"> </a>

What I really dont get ( see the spritesheet.png I made above , is why profile is at co-ordinates 32,32 and why analytics is at co-ordinates 64,32

Perhaps I have my co-ords wrong lol

This is driving me mad now, argghhh

Added the actual sprite sheet now, but I am buggered if I can get so-ordinates to play with me lol
Image added:

![alt text][5]

Finally figured it out.

  • 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-18T10:35:39+00:00Added an answer on May 18, 2026 at 10:35 am

    You could combine the selectors like so.

    #logo-link,#logo-link2
    {
        width:32px;
        height:32px;
        text-decoration:none;
        display:block;
        background-position:0 32px;
    }
    #logo-link:hover,#logo-link:active,#logo-link2:hover,#logo-link2:active {background-position:0 0;}
    
    #logo-link{background-image:url(sprites/analytics.png);}
    #logo-link2{background-image:url(sprites/addlisting.png);}
    

    Alternatively you could add a class called sprite

    .sprite
    {
        width:32px;
        height:32px;
        text-decoration:none;
        display:block;
        background-position:0 32px;
    }
    .sprite:hover,.sprite:active {background-position:0 0;}
    
    #logo-link{background-image:url(sprites/analytics.png);}
    #logo-link2{background-image:url(sprites/addlisting.png);}
    

    And the html

    <a href="link1.html" id="logo-link" class="sprite"> </a>
    
    <a href="link2.html" id="logo-link2" class="sprite"> </a>
    

    Edit: Here is another alternative if you plan on using a sprite sheet.

    .sprite
    {
        width:32px;
        height:32px;
        text-decoration:none;
        display:block;
        background-image:url(spritesheet.png);
    }
    .analytics{background-position:0 0;}
    .analytics:hover{background-position:0 0;}
    .addlisting{background-position:0 0;}
    .addlisting:hover{background-position:0 0;}
    

    HTML:

    <a href="link2.html" class="sprite addlisting"> </a>
    

    And a jsfiddle
    http://jsfiddle.net/gJkCZ/

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

Sidebar

Related Questions

The Sensor Fusion video looks great, but there's no code: http://www.youtube.com/watch?v=C7JQ7Rpwn2k&feature=player_detailpage#t=1315s Here is my
I've got someone creating images (PNGs) for my Android application and they look great
Python loves raising exceptions, which is usually great. But I'm facing some strings I
SubSonic is great and helps me code a lot faster, but now I've run
I've spent a great long while googling this problem without any luck and I've
I've created a basic orthographic shader that displays sprites from textures. It works great.
Great tool, does everything I need. Love its Transform tab that allows compression of
REPL in EMACS is really a great feature I love so much. but under
It's a great environment, but when I right click on, say a model .rb
I just recently got into using vim, and am having great fun adding load

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.