And here I am with another problem. Basically I added the same thing for some other images, but they don’t resize to the size that I need. They are originally 40px per 40px. I have the spirit image file with all of them, and when I call them I have in place these CSS rules:
You can’t change the size of the sprite images themselves if that’s what you mean? The images will always be at the size they are in the sprite. If you want to scale an image to fit the background then you need single images (not sprites) and then you can use background-size:cover to make them cover the whole background of the element.
Happy new year guys! At least for me it’s the 1th!
Anyway, @Gandalf, nope, I did the typo error here in the post but I have it correct in the CSS style on my website. But thank you! @PaulOB Yup, that’s what I meant. So - poor me - I’ll have to recreate the spirite, but first I’ll need to scale all the images to be 25x25px. Argh, ok! Let me see if I can do it. I’ll let you know if I’ll have some problems! Thank you again for all!
I’m posting this because I found that maybe I could use the background-size property, even if it’s not supported on IE 8 or less. I can use it. If someone is running IE 8 and if they will see it like it’s right now, well, no problem. Anyway, I can’t make it work even trying to use that property to be true! Let me know if I should really consider to resize all the images and create a new sprite image.
Thank you so much, coothead! I solved using this one more time:
It did all the calculations for me and this way I saved some time. Now everything works like a charm and I saved something like 100 requests on the page load. I’m loving these CSS sprites.
Obviously I had first to resize all the images to 25x25px, but using a batch action on the image editing program was pretty easy to do. Thank you all for the help given here, I really appreciated it.
I have another question for you guys. Now instead of the <img tag I have a <span. I had the alt attribute for all the images, but now I had to remove it. Should I use title="" instead?