Results 1 to 3 of 3
  1. #1
    Susans is offline Sophomore
    Join Date
    Aug 2011
    Location
    USA
    Posts
    113
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Feedback Score
    0

    Default What is CSS Sprites? How it works? How to use it?

    I heard that CSS Spirits can help in decreasing the number of HTTP request thus improving the site load time. I tried searching and found lot of information about it... but it was difficult for me to understand (Since I am a newbie).

    Can someone help in explaining what does CSS Spirits mean.. How can I use it (in simple steps) and how can I apply it to my website to decrease the load time?

  2. #2
    ipxcore is offline Freshman
    Join Date
    Dec 2011
    Location
    Phoenix, AZ. USA
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Feedback Score
    0

    Default

    Basically a CSS Sprit is several image files combined into one. Thus only using one HTTP request for all of the (design) images on your site. Once you combine your images you must specify in the CSS which section of the image to display.

    Here is an example of CSS without sprites:
    #nav li a {background:none no-repeat left center}#nav li a.item1 {background-image:url('../img/image1.gif')}
    #nav li a:hover.item1 {background-image:url('../img/image1_over.gif')}
    #nav li a.item2 {background-image:url('../img/image2.gif')}
    #nav li a:hover.item2 {background-image:url('../img/image2_over.gif')}

    and this is what it would look like with sprites:
    #nav li a {background-image:url('../img/image_nav.gif')}#nav li a.item1 {background-position:0px 0px}
    #nav li a:hover.item1 {background-position:0px -72px}
    #nav li a.item2 {background-position:0px -143px;}
    #nav li a:hover.item2 {background-position:0px -215px;}

  3. #3
    foodsurveys is offline Freshman
    Join Date
    Mar 2012
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Feedback Score
    0

    Default

    ipxcore has answered this well, so I will just add that the thing which first made me aware of sprites and their usefulness by way of a practical example. When I was trying to create a menu with hover-over effects (the actual design was like a wooden fence swinging when you hovered - so it had to be images rather than just css effects). I found that using two separate images gave me a tiny moment where the image vanished on hover-over while it loaded - no matter how small I made the image. This was resolved by combining the two images, as discussed above. Just a little practical example.

Similar Threads

  1. How Alexa works?
    By sarita in forum All Other Search Engines
    Replies: 11
    Last Post: 09-26-2011, 03:49 AM
  2. When SEO works.
    By Vin Jackson in forum Search Engine Optimization
    Replies: 7
    Last Post: 06-20-2011, 03:40 AM
  3. how alexa works?
    By ovaismirza22 in forum Search Engines
    Replies: 6
    Last Post: 03-25-2010, 03:14 AM
  4. What works best for you?
    By wujijiangjun in forum General Marketing
    Replies: 7
    Last Post: 06-10-2008, 11:54 AM
  5. Ehat works for you?
    By wujijiangjun in forum General Marketing
    Replies: 1
    Last Post: 05-13-2008, 11:06 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Partners: BOSTON WEB DEVELOPER, LLC   |   WEBCOSMO CLASSIFIEDS