|
|
|
|
Thread title: CSS Sprites |
|
|
|
|
|
Thread tools
Search this thread
Display Modes
|
|
08-27-2010, 08:53 PM
|
#1
|
Status: #pugs {display: block;}
Join date: Jan 2007
Location: Chicago
Expertise: CSS, HTML, PHP
Software: Sublime Text 2
Posts: 1,187
|
CSS Sprites
I'm not a stranger to sprites but I primarily limit my usage of them. I don't toss every image into a sprite. I tend to just stick with navigation majority of the time although very rarely have I had a project that required extras.
I used to do headings but after Cufon/@font-face came to play I no longer do that.
- How often do you use sprites?
- Do you use them for EVERY image (backgrounds included but excluding those you need to repeat)?
- Or just a few here and there?
- Does it really make THAT big of a difference when it comes to shaving off some load time?
I've got a client right now that wants to have ALL non-repeating images put into a single sprite. Truthfully, it's a huge pain in the ass right now as the site is already fully developed.. So I'm having to ensure that a.) I'm grabbing all images, b.) the code isn't going to conflict with the already existing styles. And I really just don't see the point in having 60+ images in a single sprite file... but I've never been one that used that many images in the first place ;\.
|
|
09-11-2010, 06:19 AM
|
#2
|
Status: Request a custom title
Join date: Feb 2005
Location:
Expertise:
Software:
Posts: 3,164
|
I use sprites for layout only.
I wouldn't recommend using them for images that are displayed as actual images on the site, but I've seen it done. :S
One thing to bear in mind is if your client ever wants edit one of the images to a large/smaller size.. that'll be quite the fudgecaked situation.. messing up the styling completely.
Though the amount of time you save from compressing alone is worth it.
|
|
09-11-2010, 11:55 AM
|
#3
|
Status: I'm new around here
Join date: Sep 2010
Location: France
Expertise: Web design/programming
Software: Photoshop, Netbeans, Firefox
Posts: 12
|
Like Dan, I only use sprites for layout images. Sprites are really useful but there are more noticeable ways of speeding up the website then what you'd gain by sticking together all the images into one sprite.
It's also not worth it if you're going to be making regular changes to the images. I do think there is one place they should always be used and that's with hover events, makes things much smoother.
In your clients case unless all of the images are loaded on the same page I really doubt that a sprite is necessary. I definitely wouldn't put 60+ in a single sprite that would be a nightmare to create & edit.
|
|
09-11-2010, 02:35 PM
|
#4
|
Status: Senior Member
Join date: Mar 2005
Location: Singapore
Expertise: Web Design, XHTML/CSS
Software: Photoshop, Illustrator
Posts: 861
|
I only use sprites for icons and repeated patterns.
|
|
09-12-2010, 09:08 AM
|
#5
|
Status: Junior Member
Join date: Sep 2010
Location: Israel
Expertise: Design, Web Development
Software: Photoshop, Dreamweaver, FF
Posts: 42
|
I use sprites, more and more recently. I sprite almost all images, it does save up loading speed and you get maximum quality (if you're saving with PNG).
Here is one example:
but with time, I get better at it and know which elements to sprite and which elements to keep separated.
As for the editing, I always keep an organized PSD file with all images so I could easily edit, also with ruler guides so I could get the height, width, X and Y coordination of the specific image.
And the CSS coding, isn't that hard, it's all about background positioning the hard part is just getting each image's coordination.
|
|
09-12-2010, 03:31 PM
|
#6
|
Status: Request a custom title
Join date: Feb 2005
Location:
Expertise:
Software:
Posts: 3,164
|
wow. sprites that large are surely going to have a negative effect?
|
|
09-15-2010, 12:15 AM
|
#7
|
Status: I'm new around here
Join date: Sep 2010
Location:
Expertise:
Software:
Posts: 1
|
I usually do sprites but I am always trying to keep best balance between loading speed and number of files. It means that I sometimes prefer to have 2 different sprites, each one for example 50 kB, than one with weight of 200 kB. But I am usually fine with one.
|
|
09-15-2010, 10:57 AM
|
#8
|
Status: Request a custom title
Join date: Apr 2007
Location: UK
Expertise: Code & Programming
Software: Coda, TextMate, Sublime 2
Posts: 2,097
|
Aziz, I would think hard on whether that's the correct application of sprites. The whole aim of sprites is to decrease the number of HTTP requests to images. The more requests = the longer page load it will take.
Now the problem with making such a huge sprite image is not the number of HTTP requests. It is the question of size. On page load the browser will only have to make one request for images, the sprite, but it will take a long time to load. Granted, it will probably take less time than requesting each image separately, but it will still take some time. The problem with this is that while the image is loading no image is displayed. Just text. The whole image has to be loaded before background positions can be used and an image is displayed. Using a few, smaller sprite images would both reduce the number of HTTP requests than normal and to provide images of a weight that's quickly renderable.
|
|
09-15-2010, 04:03 PM
|
#9
|
Status: Junior Member
Join date: Mar 2010
Location: Omaha, Nebraska, USA
Expertise: Web Hosting, Servers
Software: Notepad
Posts: 63
|
I use sprites quite often, as with the above, mainly for navaigation, logo and common images that repeat throughout the site (the whole purpose of sprites). Between the combination of sprites and then using a CDN to push all the content to the customers, we get pretty great speeds on sites and would never go back to regular images. Add in a little gzip/mod_deflate, and the site really starts to sing!
|
|
09-26-2010, 01:23 AM
|
#10
|
Status: I'm new around here
Join date: Sep 2010
Location:
Expertise:
Software:
Posts: 3
|
I pretty much only use them for nav graphics that have a hover state.
I'm surprised to hear that people use such large sprites, with so many images packed into one file. I suppose overall load time might be a little faster (?), but I would think that the *apparent* load time would seem slower for the user, since as mentioned nothing will display until the entire image is loaded. At least with multiple files they can be downloading simultaneously and showing up as they come in. I haven't done any actual testing of this though, so maybe I'm wrong.
|
|
|
|
|
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
|