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

Why Use CSS Sprites Part 1

9/10/2009
Bookmark and Share
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

Add your comments:

Items in bold indicate required information.

Name :
 
Email :
 
Comments :
 
 
Latest Posts

Categories
Blogging (2)
Google (3)
Local (2)
Website Design (4)
Website Functionality (5)
Internet Marketing (90)
Company News (6)
Email Marketing (7)
General Marketing (11)
Google Android (2)
Local Search (12)
Mobile Search (2)
Offline Marketing (2)
PPC (13)
RSS (5)
Search Engine Optimization (36)
Social Media (9)
Social Networking (18)
General Programming (2)
SQL Programming (2)
Video Search Engine Optimization (3)

Archives

Blogroll
Melbourne Web Design
Orlando Search Marketing
Lakeland Web Design
ASP.NET CMS

Feeds



Newsletter Signup
Enter your email address below and receive special offers.
From Our Customers
"Since SMT was hired to bring our website up to standards, it has garnered continuous growth in its, page views and has consistently been recognized in the eHealthcare awards. We are very pleased with SMT’s work and customer service. We would gladly recommend them to others."

Marcia Diaz de Villegas – Miami Children’s Hospital Director of Marketing & Public Relations
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-682-2222

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