Sales and Marketing Technologies
Search
Do you want Breakthrough Results? Let us help you.
Click to boost online marketing results! Click to sign up for our FREE e-Newsletter
Custom Web Development E-commerce Solutions Web Consulting Web Maintenance Web Hosting CMS Solutions
Internet Marketing Consulting Local Search Marketing Pay Per Click Management Reputation Management SEO Services Social Networking Video SEO (VSEO)
Miami Children's Hospital Reflectx Services Dinnerware Depot U.S. Home Filter
What We Offer Altamonte Springs Office Orlando Office
Internet Marketing Blog Contact Us Refer a Client Employment
Blog

Why Use CSS Sprites Part 1

Thursday, September 10, 2009
You’ve heard the term bouncing around the Internet, but still not sure what, why, or how to use CSS Sprites.  I’m here to enlighten you on this neat little feature that is sure to help speed up your site.  This is part 1 of a 2 part series blog.  Part 2 will entail “How To Use CSS Sprites”.

Why would I want to use a CSS sprite?
CSS sprites reduce the total number of http requests, can reduce the total size of the images, and increase your pages load time. 

For example, if you build an unordered list and intend of having four (4) different list item images; that is 8 different HTTP requests, assuming you use a hover and are not using the CSS Sprite technique. 

Here is an example of what the CSS might look like without the CSS Sprite technique:
 
#nav li a {background:none no-repeat left center}
#nav li a.item1 {background-image:url('../images/image1.gif')}
#nav li a:hover.item1 {background-image:url('../images/image1_over.gif')}
#nav li a.item2 {background-image:url('../images/image2.gif')}
#nav li a:hover.item2 {background-image:url('../images/image2_over.gif')}
...

 
 
 Using the CSS Sprites requires we consolidate all four of our images into one image.  I will show you more details on how this is done in part 2.  After you have the CSS Sprite image created, you will need to create the new CSS for it.  My CSS looked like this:

#nav li a {background-image:url('../images/image_nav.gif')}
#nav li a.item1 {background-position:0px 0px}
#nav li a:hover.item1 {background-position:0px -54px}
#nav li a.item2 {background-position:0px -108px;}
#nav li a:hover.item2 {background-position:0px -162px;}
...
 
 
Now, using the CSS Sprites, we were able to cut down the HTTP requests to 1 and the total file size of all the images to 26 KB.  Imagine multiplying that by all the list items you have.  It adds up very quickly. 

In the end, this will reduce on your load time and increase the user experience.  Don’t forget, in Part 2, I will show you how to make and use CSS Sprites.
 

 
Jonathan Crowe 9/10/2009 4:07:00 PM

Add your comments:

Items in bold indicate required information.

Name :
 
Email :
 
Comments :
 
Our Work    |    Web Development    |    Internet Marketing    |    Case Studies    |    FAQ    |    About SMT    |    Press Room
Employment    |    Refer a Client    |    Contact Us    |    Internet Marketing Blog    |    Privacy Policy    |    Site Map

Sales & Marketing Technologies
Altamonte Springs: 220 E. Central Parkway, Suite 1010 • Altamonte Springs, FL 32701407-792-4848
Orlando: 301 E. Pine Street, Suite 150 • Orlando, FL 32801407-792-1951

© 2010, Sales & Marketing Technologies, Ltd. All rights reserved.
Website Design FL & Search Engine Optimization Services

Serving Altamonte Springs, Apopka, Casselberry, Celebration, Lake Mary, Longwood, Kissimmee, Maitland, Orlando, Ovideo, Windermere, Winter Park, Winter Springs and other areas throughout Central Florida and the United States.