SlideShare a Scribd company logo
Improving performance with CSS Sprite

                            Shyamala Prayaga
                           20 November 2008




         © 2008 MindTree
Agenda


 Performance – why and what?
 14 Rules to improve performance
 What is CSS Sprite?
 How do CSS Sprites work?
 CSS Sprite Demo
 Benefits of CSS sprite




                                © 2008 MindTree   Slide 2
Why Performance ?


   80-90% of the end-user response time is
           spent on the frontend.


    Increase Speed
    Faster web site increases traffic, repeat visits, clicks, and
     conversions
    Encourage repeated usage




                                © 2008 MindTree                      Slide 3
Performance


     Importance of frontend Performance.




 Back-end = 5%                        Front-end = 95%




                    © 2008 MindTree              Slide 4
Performance Type


           Performance have 2 flavors



    Response Time
    System Efficiency




                         © 2008 MindTree
14 Rules

1.    Make fewer HTTP requests
2.    Use a CDN
3.    Add an Expires header
4.    Gzip components
5.    Put Style sheets at the top
6.    Move scripts to the bottom
7.    Avoid CSS expressions
8.    Make JS and CSS external
9.    Reduce DNS lookups
10.   Minify JS
11.   Avoid redirects
12.   Remove duplicate scripts
13.   Configure ETags
14.   Make AJAX cacheable
                                    © 2008 MindTree   Slide 6
Rule 1: Make fewer HTTP request




   ©© 2008 MindTree
    2008 MindTree
Reducing HTTP Request


 80-90% of load time is from the frontend
 Most of this time is spent on downloading all the components in
  the page: images, Style sheets, scripts, Flash, etc.
 Reducing the number of components in turn reduces the number of
  HTTP requests required to render the page.
 The less the HTTP Request is the faster is the Page.




                                © 2008 MindTree                     Slide 8
Techniques for reducing the number of HTTP requests


  CSS sprites
  Image Maps
  Inline Images
  Combined scripts & combined Stylesheets




                              © 2008 MindTree         Slide 9
© 2008 MindTree   Slide 10
What is CSS Sprite?

 CSS Sprites are the preferred method for reducing the number of
  image requests.


 CSS sprites allow you to create a single file that contains all the
  images laid out in a grid, requiring only a single image and only a
  single server call.




                                   © 2008 MindTree                      Slide 11
CSS Sprite

 multiple CSS background images => one image

 <div style="background-image:
 url('a_lot_of_sprites.gif');
 background-position:
   -260px -90px;
 width: 26px;
 height: 24px;">
 </div>
 overall size reduced
 generator: http://spritegen.website-performance.org/
 http://stevesouders.com/examples/sprites.php
                              © 2008 MindTree           Slide 12
Before




         Number of HTTP
            Request
               8

         Total Image size
             20.5 kb




              © 2008 MindTree   Slide 13
After




        Number of HTTP
           Request
              1

        Total Image size
             13 kb




            © 2008 MindTree   Slide 14
How CSS Sprite works?


  The idea behind CSS sprites is to consolidate multiple images into
  one sprite and then selectively display portions of this sprite with
  background positioning.
  The Steps are as follows
   Group multiple images together (usually icons or decorative images) into
    one sprite
   Evenly space these images, aligned into one or more lines
   Set this sprite to the background image of an element (usually a list)
   Position the sprite to display the appropriate image by shifting the X or Y
    position by a multiple of the spacing




                                    © 2008 MindTree                           Slide 15
Benefits


  Increases Page Load Speed
  Improves accessibility
  Saves time
  saves bandwidth




                               © 2008 MindTree   Slide 16
Demo




       © 2008 MindTree   Slide 17
Questions




            © 2008 MindTree   Slide 18
Imagination Action Joy




                                       Shyamala Prayaga
                         shyamala_prayaga@mindtree.com

                                     www.mindtree.com

      ©© 2008 MindTree
       2008 MindTree

More Related Content

PPTX
How to turn your website speed from zero to hero
PDF
High Performance Images in WordPress
PDF
Dealing with media
PDF
DDS Web Programming with dscript
PPTX
Sprite ppt
PDF
uitleg 2e jaars
PPTX
Sprite Seedhi Baat No Bakwas
PPT
Css sprite best practices
How to turn your website speed from zero to hero
High Performance Images in WordPress
Dealing with media
DDS Web Programming with dscript
Sprite ppt
uitleg 2e jaars
Sprite Seedhi Baat No Bakwas
Css sprite best practices

Viewers also liked (12)

PPTX
How Sprite Engaged 2 Mn Teens - Teen Till I Die - Case Study
PPTX
Sprite - Rasta Clear Hai!!!
PDF
Introduction to Sprite Kit
PPTX
Sprite Branding Elements
PPTX
Britania final
PPTX
Sprite (soft drink) Case Study Presentation
PPTX
Britania Biscuit - A details presentation on various products & its marketing...
PDF
Beyond pink: Research on marketing to women consumers
PDF
20537240 Parle G Marketing Strategy
PPT
Marketing research
PPSX
Research hypothesis
PPTX
DEFINING THE MARKETING RESEARCH PROBLEM AND DEVELOPING AN APPROACH
How Sprite Engaged 2 Mn Teens - Teen Till I Die - Case Study
Sprite - Rasta Clear Hai!!!
Introduction to Sprite Kit
Sprite Branding Elements
Britania final
Sprite (soft drink) Case Study Presentation
Britania Biscuit - A details presentation on various products & its marketing...
Beyond pink: Research on marketing to women consumers
20537240 Parle G Marketing Strategy
Marketing research
Research hypothesis
DEFINING THE MARKETING RESEARCH PROBLEM AND DEVELOPING AN APPROACH
Ad

Similar to Improving Site Performace Using Css Sprite (20)

PDF
Website Performance at Client Level
PDF
A little journey into website optimization
PPTX
EscConf - Deep Dive Frontend Optimization
PPTX
Mastering CSS for Backend Developers.pptx
PDF
High Performance Websites
PPTX
Presentation Tier optimizations
PDF
Tips tricks deliver_high_performing_secure_web_pages
KEY
HTML CSS & Javascript
PPTX
Velocity NY 2013 - From Slow to Fast: Improving Performance on Intuit Website...
PPTX
Tech talk
 
PPT
Decoding the Web
PPTX
Website Performance
PDF
High Performance Front-End Development
ODP
9 Useful Things that Every Web Developer Needs to Know
PPT
Your Images are Weighing You Down: Optimization for a Better UX
PDF
Front end performance tip
PDF
High performance website
PPT
performance.ppt
PPTX
Web Optimisation
PDF
20 tips for website performance
Website Performance at Client Level
A little journey into website optimization
EscConf - Deep Dive Frontend Optimization
Mastering CSS for Backend Developers.pptx
High Performance Websites
Presentation Tier optimizations
Tips tricks deliver_high_performing_secure_web_pages
HTML CSS & Javascript
Velocity NY 2013 - From Slow to Fast: Improving Performance on Intuit Website...
Tech talk
 
Decoding the Web
Website Performance
High Performance Front-End Development
9 Useful Things that Every Web Developer Needs to Know
Your Images are Weighing You Down: Optimization for a Better UX
Front end performance tip
High performance website
performance.ppt
Web Optimisation
20 tips for website performance
Ad

More from Shyamala Prayaga (20)

PDF
HealthyCodeMay2014
PPTX
Leveraging Augmented Reality Capability for enhancing the shopping experience
PDF
My Interview with Healthy code Magazine: Future of Android Design
PDF
Ticketing Application
PPTX
Interaction design workshop
PPTX
Android design in action
PDF
Mobile accessibility challenges and best practices v2
PDF
Mobile Prototyping
PPTX
MOBILE INTERACTION PATTERNS AND NON PATTERNS
PDF
Adobe Flex - Developing Rich Internet Application Workshop Day 2
PDF
Adobe Flex - Developing Rich Internet Application Workshop Day 2
PPTX
Accessibility and ucd
PPTX
Android Design
DOC
Mobile UI and Usability Guidelines V1
KEY
Mobile Web Frameworks
PPT
iPhone application development training day 1
PPTX
Usability Testing
PPTX
Ethenographic research
PPTX
Universal Design
HealthyCodeMay2014
Leveraging Augmented Reality Capability for enhancing the shopping experience
My Interview with Healthy code Magazine: Future of Android Design
Ticketing Application
Interaction design workshop
Android design in action
Mobile accessibility challenges and best practices v2
Mobile Prototyping
MOBILE INTERACTION PATTERNS AND NON PATTERNS
Adobe Flex - Developing Rich Internet Application Workshop Day 2
Adobe Flex - Developing Rich Internet Application Workshop Day 2
Accessibility and ucd
Android Design
Mobile UI and Usability Guidelines V1
Mobile Web Frameworks
iPhone application development training day 1
Usability Testing
Ethenographic research
Universal Design

Improving Site Performace Using Css Sprite

  • 1. Improving performance with CSS Sprite Shyamala Prayaga 20 November 2008 © 2008 MindTree
  • 2. Agenda  Performance – why and what?  14 Rules to improve performance  What is CSS Sprite?  How do CSS Sprites work?  CSS Sprite Demo  Benefits of CSS sprite © 2008 MindTree Slide 2
  • 3. Why Performance ? 80-90% of the end-user response time is spent on the frontend.  Increase Speed  Faster web site increases traffic, repeat visits, clicks, and conversions  Encourage repeated usage © 2008 MindTree Slide 3
  • 4. Performance Importance of frontend Performance. Back-end = 5% Front-end = 95% © 2008 MindTree Slide 4
  • 5. Performance Type Performance have 2 flavors  Response Time  System Efficiency © 2008 MindTree
  • 6. 14 Rules 1. Make fewer HTTP requests 2. Use a CDN 3. Add an Expires header 4. Gzip components 5. Put Style sheets at the top 6. Move scripts to the bottom 7. Avoid CSS expressions 8. Make JS and CSS external 9. Reduce DNS lookups 10. Minify JS 11. Avoid redirects 12. Remove duplicate scripts 13. Configure ETags 14. Make AJAX cacheable © 2008 MindTree Slide 6
  • 7. Rule 1: Make fewer HTTP request ©© 2008 MindTree 2008 MindTree
  • 8. Reducing HTTP Request  80-90% of load time is from the frontend  Most of this time is spent on downloading all the components in the page: images, Style sheets, scripts, Flash, etc.  Reducing the number of components in turn reduces the number of HTTP requests required to render the page.  The less the HTTP Request is the faster is the Page. © 2008 MindTree Slide 8
  • 9. Techniques for reducing the number of HTTP requests  CSS sprites  Image Maps  Inline Images  Combined scripts & combined Stylesheets © 2008 MindTree Slide 9
  • 10. © 2008 MindTree Slide 10
  • 11. What is CSS Sprite?  CSS Sprites are the preferred method for reducing the number of image requests.  CSS sprites allow you to create a single file that contains all the images laid out in a grid, requiring only a single image and only a single server call. © 2008 MindTree Slide 11
  • 12. CSS Sprite multiple CSS background images => one image <div style="background-image: url('a_lot_of_sprites.gif'); background-position: -260px -90px; width: 26px; height: 24px;"> </div> overall size reduced generator: http://spritegen.website-performance.org/ http://stevesouders.com/examples/sprites.php © 2008 MindTree Slide 12
  • 13. Before Number of HTTP Request 8 Total Image size 20.5 kb © 2008 MindTree Slide 13
  • 14. After Number of HTTP Request 1 Total Image size 13 kb © 2008 MindTree Slide 14
  • 15. How CSS Sprite works?  The idea behind CSS sprites is to consolidate multiple images into one sprite and then selectively display portions of this sprite with background positioning.  The Steps are as follows  Group multiple images together (usually icons or decorative images) into one sprite  Evenly space these images, aligned into one or more lines  Set this sprite to the background image of an element (usually a list)  Position the sprite to display the appropriate image by shifting the X or Y position by a multiple of the spacing © 2008 MindTree Slide 15
  • 16. Benefits  Increases Page Load Speed  Improves accessibility  Saves time  saves bandwidth © 2008 MindTree Slide 16
  • 17. Demo © 2008 MindTree Slide 17
  • 18. Questions © 2008 MindTree Slide 18
  • 19. Imagination Action Joy Shyamala Prayaga shyamala_prayaga@mindtree.com www.mindtree.com ©© 2008 MindTree 2008 MindTree