Thread: CSS Sprites?

Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2011
    Posts
    5
    Plugin Contributions
    0

    Default CSS Sprites?

    Hi, I'm trying to reduce the loading times of the website I'm working on; and I've read that using sprites instead of indivual image requests would help.

    I've used an online sprite generator to get the sprite 'map?' and the underlying code. I'm just not sure where to put it.
    I've been given this to insert into the background somewhere, perhaps the header.php etc:

    #container li {
    background: url(spritemap.png) no-repeat top left;
    }

    I also have the classes needed for the defining, such as:
    .box-bot-bg{ background-position: 0 0; width: 200px; height: 188px; }

    Would I just need to put this into my current CSS, or would it involve a bit more work?

    Thanks.

  2. #2
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: CSS Sprites and Zencart

    This CSS would definitely not work as is, unless you currently have custom elements with id #container and class .box-bot-bg.
    We need a lot more information on where you are using this and a link to see your site before we can advise on using your generated style rules (which would go in your stylesheet.css if they are applicable). Depending on where you want to use sprites, it may not be feasible to insert them into dynamically-generated elements.

  3. #3
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: CSS Sprites and Zencart

    It's certainly possible to use sprites for Zen Cart sites. We use them quite often and it can have a significant impact on loading times and the smoothness of rollovers.

    But it's quite an advanced technique - certainly not something that you just drop into a site. It requires quite a lot of planning and precision positioning of images within the sprite, so that they can be referenced to pixel accuracy in the css.
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  4. #4
    Join Date
    Jun 2008
    Location
    UK
    Posts
    209
    Plugin Contributions
    0

    Default Re: CSS Sprites and Zencart

    Although this topic about CSS Sprites was created several years ago.

    I too would like to know about sprites.

    According to http://gtmetrix.com/reports/www.tidytoys.co.uk/evNapt3l this is the number 1 thing that could be used to speed up my website.

    This report said which images needed to go into a sprite ... so I paid for someone to create me a sprite and to create the css file that points to the images in the sprite.

    I couldnt find any information that would show how and where to change the zen cart coding to pick up and use the ccs and sprite for a zen cart.

    Even if I could be shown how to pick my credit card logos up from the sprite that would be great.

  5. #5
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: CSS Sprites and Zencart

    You would have to locate every bit of code that uses one of those images, and change it to refer to the sprite image instead of the individual image. Then you would have to alter the CSS to use selectors that address the particular element that contains the image. If your paid worker correctly built the CSS to refer to all the correct elements, you should be okay there.

    Be aware that there are numerous elements that do not have uniquely identifiable class/id tags or any way to single them out from all other like items. In those cases, you will need to add tags to achieve enough individuality to address unique elements.

  6. #6
    Join Date
    Aug 2005
    Location
    Vic, Oz
    Posts
    1,905
    Plugin Contributions
    5

    Default Re: CSS Sprites and Zencart

    Quote Originally Posted by gjh42 View Post
    You would have to locate every bit of code that uses one of those images, and change it to refer to the sprite image instead of the individual image. Then you would have to alter the CSS to use selectors that address the particular element that contains the image. If your paid worker correctly built the CSS to refer to all the correct elements, you should be okay there.

    Be aware that there are numerous elements that do not have uniquely identifiable class/id tags or any way to single them out from all other like items. In those cases, you will need to add tags to achieve enough individuality to address unique elements.
    iow Far toooo much work
    For so little (if any) gain...

 

 

Similar Threads

  1. v151 How to uninstall CSS Horizontal Drop Down Menu (CSS Flyout Header 1.5)
    By cmike in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 15 Feb 2014, 07:39 AM
  2. css horizonal navigational menu with sprites
    By jim23866 in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 30 Oct 2010, 02:42 AM
  3. CSS Sprites
    By smoke133 in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 3 Jul 2009, 11:42 PM
  4. want to reposition an image using css. what is css to control this?
    By what44 in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 10 Nov 2007, 05:03 AM
  5. how to insert css buttons created with CSS Tab Designer 2?
    By lankeeyankee in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 24 Mar 2007, 08:27 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR