jimfog Posted October 19, 2012 Share Posted October 19, 2012 I intend using image sprites, but the thing I do not know if it is recommended for image depiction scenarios. Let me explain: I want two images(the images of arrows) to appear simultaneously in the page.Is a sprite to way to in such a case? I think yes, I am not sure though. Somehow I think that css sprites is best for hover elements-when we need the part of the image sprite one at a time. Link to comment Share on other sites More sharing options...
dsonesuk Posted October 19, 2012 Share Posted October 19, 2012 Sprites are used to show usually 2 different stages, the default/normal and the hover as one single image, and usullay as a background image, the advantages are, if you use two images, on the first instance of hover a slight delay is seen, as the hover stage image loads, whereas with sprite image the two stages are loaded in one go. As background position is used to show different image stages at a giving stage, it is possible to load different stages of all images used on your website in one large sprite. Then all these images will be preloaded and ready to use. Link to comment Share on other sites More sharing options...
jimfog Posted October 19, 2012 Author Share Posted October 19, 2012 So it is not so appropriate for my case as I understand. tell me if I understood correctly. Link to comment Share on other sites More sharing options...
thescientist Posted October 19, 2012 Share Posted October 19, 2012 think of sprites as preloading all your images through one really large image (i.e. one large image composed of all your sites images), and just using background-position to show the right part of the large image, that focuses on just the image you want. it is applicable in any situation where you want to use images, since its a general optimization technique, requiring less HTTP requests for the same amount of resources. (and thus no "blinks"/flickers) like in the situation dsonesuk described. Link to comment Share on other sites More sharing options...
justsomeguy Posted October 19, 2012 Share Posted October 19, 2012 It's fine to use sprites even if the images are static, sprites save the overhead involved in HTML requests because you have to make fewer requests to get the images if they are combined in the same file. I use sprites that have 20 or so different images in them for various buttons and states, like this one: Link to comment Share on other sites More sharing options...
Don E Posted October 19, 2012 Share Posted October 19, 2012 One thing about sprites is how to get the exact position for that particular image(icon)... Sometimes it can be a task resulting in half an icon to appear sometimes.. Link to comment Share on other sites More sharing options...
jimfog Posted October 21, 2012 Author Share Posted October 21, 2012 It's fine to use sprites even if the images are static, sprites save the overhead involved in HTML requests because you have to make fewer requests to get the images if they are combined in the same file. I use sprites that have 20 or so different images in them for various buttons and states, like this one: Seing this image now, I am going to be more specific about where I want to use the arrows-it is for a calendar, as such the arrows need to be there all the time-when changing the days for example. The above example lies behind my question. What do you think? Link to comment Share on other sites More sharing options...
dsonesuk Posted October 21, 2012 Share Posted October 21, 2012 You are talking about just to plain arrow images, with no hover effect, yes! Well a sprite might not be neccessay, but it might save you kbits in in file size. So just try it, if you save in file size use sprite, else you might as well use individual images. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now