...

View Full Version : CSS sprites, is this even possible??



pito189
05-05-2009, 07:30 AM
First off I don't even know this is possible, I am trying to work with sprites for the first time, so I might be way off.

http://paulchinetti.com/1newpaul/ImageSlide.html

Say I want to have 1-6 red and then 7-9 green and 10-20 yellow to represent different areas of work.

Is that even possible with sprites or am I going about it in the wrong way all together. I've read a few articles and it seems like this would be a good idea to go about it but I can't get it to work like the articles say. :confused:

CalumK
05-05-2009, 08:51 AM
I think ive found your problem....

in your css (i did some digging round your code...)
you have the following


/* #container li {
background: url(images/sprite1.png) no-repeat top left;
} */

.sprite-blue { background-position: 0 -10px; }
.sprite-brown { background-position: 0 -82px; }
.sprite-green { background-position: 0 -134px; }
.sprite-pink { background-position: 0 -186px; }
.sprite-red { background-position: 0 -238px; }
.sprite-yellow { background-position: 0 -290px; }


but in yout html, you dont have a

<div id='container'></div>
so you are never going to get it to work... i think what you want to do is change your css to..



#gallery li {
background: url(images/sprite1.png) no-repeat top left;
}
the only other time you reference your sprite image is in


.stripTransmitter ul { /* the auto-generated set of links */
position: relative;
list-style-type: none;
background: url(images/sprite1.png) no-repeat top left;
}


but i dont think you ever reference that in your html.. but it might be in the javascript somewhere.. i didnt check...

hope that helps a bit...


also im not sure that


<a class="sprite-green"> is the best way to call it.. i think you may need to change it so that eachi <li> defines the class... but im not sure really.. just thaught id point it out...

pito189
05-12-2009, 07:41 AM
Thanks for the help, I can't seem to get it to work at all. I keep changing things and nothing changes, I guess sprites are above me, that sucks.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum