SlideShare ist ein Scribd-Unternehmen logo
1 von 19
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

Weitere ähnliche Inhalte

Andere mochten auch

Sprite Branding Elements
Sprite Branding ElementsSprite Branding Elements
Sprite Branding Elements
rmoloko
 
Sprite (soft drink) Case Study Presentation
Sprite (soft drink) Case Study PresentationSprite (soft drink) Case Study Presentation
Sprite (soft drink) Case Study Presentation
Cotecna Inspection
 
20537240 Parle G Marketing Strategy
20537240 Parle G Marketing Strategy20537240 Parle G Marketing Strategy
20537240 Parle G Marketing Strategy
ravi224
 
Marketing research
Marketing researchMarketing research
Marketing research
Arian Hadi
 
Research hypothesis
Research hypothesisResearch hypothesis
Research hypothesis
Nursing Path
 

Andere mochten auch (12)

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

Ähnlich wie Improving Site Performace Using Css Sprite

2009_09_11_Grid960
2009_09_11_Grid9602009_09_11_Grid960
2009_09_11_Grid960
LightSpeed
 
Asp.net performance secrets
Asp.net performance secretsAsp.net performance secrets
Asp.net performance secrets
Mahmoud Ghoz
 

Ähnlich wie Improving Site Performace Using Css Sprite (20)

Performace optimization (increase website speed)
Performace optimization (increase website speed)Performace optimization (increase website speed)
Performace optimization (increase website speed)
 
Top 10 Secrets For Speeding Up Share Point Web Sites Derek Watson Final
Top 10 Secrets For Speeding Up Share Point Web Sites Derek Watson   FinalTop 10 Secrets For Speeding Up Share Point Web Sites Derek Watson   Final
Top 10 Secrets For Speeding Up Share Point Web Sites Derek Watson Final
 
Frontend performance
Frontend performanceFrontend performance
Frontend performance
 
Drupal performance and scalability
Drupal performance and scalabilityDrupal performance and scalability
Drupal performance and scalability
 
Building high performing web pages
Building high performing web pagesBuilding high performing web pages
Building high performing web pages
 
High Performance Ajax Applications
High Performance Ajax ApplicationsHigh Performance Ajax Applications
High Performance Ajax Applications
 
Secrets of responsive web design by Sameera Thilakasiri
Secrets of responsive web design by Sameera ThilakasiriSecrets of responsive web design by Sameera Thilakasiri
Secrets of responsive web design by Sameera Thilakasiri
 
Presentation Tier optimizations
Presentation Tier optimizationsPresentation Tier optimizations
Presentation Tier optimizations
 
2009_09_11_Grid960
2009_09_11_Grid9602009_09_11_Grid960
2009_09_11_Grid960
 
Asp.net performance secrets
Asp.net performance secretsAsp.net performance secrets
Asp.net performance secrets
 
DrupalCampLA 2011 - Drupal frontend-optimizing
DrupalCampLA 2011 - Drupal frontend-optimizingDrupalCampLA 2011 - Drupal frontend-optimizing
DrupalCampLA 2011 - Drupal frontend-optimizing
 
A little journey into website optimization
A little journey into website optimizationA little journey into website optimization
A little journey into website optimization
 
MANAGE STATIC RESOURCES IN SITECORE IN HELIX WAY
MANAGE STATIC RESOURCES IN SITECORE IN HELIX WAYMANAGE STATIC RESOURCES IN SITECORE IN HELIX WAY
MANAGE STATIC RESOURCES IN SITECORE IN HELIX WAY
 
Speed!
Speed!Speed!
Speed!
 
Eco-conception Web
Eco-conception WebEco-conception Web
Eco-conception Web
 
The Need for Speed - SMX Sydney 2013
The Need for Speed - SMX Sydney 2013The Need for Speed - SMX Sydney 2013
The Need for Speed - SMX Sydney 2013
 
Wp responsive-theme-framework
Wp responsive-theme-frameworkWp responsive-theme-framework
Wp responsive-theme-framework
 
ASP.NET MVC Zero to Hero
ASP.NET MVC Zero to HeroASP.NET MVC Zero to Hero
ASP.NET MVC Zero to Hero
 
Let's dig into the Omega Theme!
Let's dig into the Omega Theme!Let's dig into the Omega Theme!
Let's dig into the Omega Theme!
 
Real-world CSS3
Real-world CSS3Real-world CSS3
Real-world CSS3
 

Mehr von Shyamala Prayaga

Interaction design workshop
Interaction design workshopInteraction design workshop
Interaction design workshop
Shyamala Prayaga
 
Mobile accessibility challenges and best practices v2
Mobile accessibility   challenges and best practices v2Mobile accessibility   challenges and best practices v2
Mobile accessibility challenges and best practices v2
Shyamala Prayaga
 
Adobe Flex - Developing Rich Internet Application Workshop Day 2
Adobe Flex - Developing Rich Internet Application Workshop Day 2Adobe Flex - Developing Rich Internet Application Workshop Day 2
Adobe Flex - Developing Rich Internet Application Workshop Day 2
Shyamala Prayaga
 
Adobe Flex - Developing Rich Internet Application Workshop Day 2
Adobe Flex - Developing Rich Internet Application Workshop Day 2Adobe Flex - Developing Rich Internet Application Workshop Day 2
Adobe Flex - Developing Rich Internet Application Workshop Day 2
Shyamala Prayaga
 
iPhone application development training day 1
iPhone application development training day 1iPhone application development training day 1
iPhone application development training day 1
Shyamala Prayaga
 

Mehr von Shyamala Prayaga (20)

HealthyCodeMay2014
HealthyCodeMay2014HealthyCodeMay2014
HealthyCodeMay2014
 
Leveraging Augmented Reality Capability for enhancing the shopping experience
Leveraging Augmented Reality Capability for enhancing the shopping experienceLeveraging Augmented Reality Capability for enhancing the shopping experience
Leveraging Augmented Reality Capability for enhancing the shopping experience
 
My Interview with Healthy code Magazine: Future of Android Design
My Interview with Healthy code Magazine: Future of Android DesignMy Interview with Healthy code Magazine: Future of Android Design
My Interview with Healthy code Magazine: Future of Android Design
 
Ticketing Application
Ticketing ApplicationTicketing Application
Ticketing Application
 
Interaction design workshop
Interaction design workshopInteraction design workshop
Interaction design workshop
 
Android design in action
Android design in actionAndroid design in action
Android design in action
 
Mobile accessibility challenges and best practices v2
Mobile accessibility   challenges and best practices v2Mobile accessibility   challenges and best practices v2
Mobile accessibility challenges and best practices v2
 
Mobile Prototyping
Mobile PrototypingMobile Prototyping
Mobile Prototyping
 
MOBILE INTERACTION PATTERNS AND NON PATTERNS
MOBILE INTERACTION PATTERNS AND NON PATTERNSMOBILE INTERACTION PATTERNS AND NON PATTERNS
MOBILE INTERACTION PATTERNS AND NON PATTERNS
 
Adobe Flex - Developing Rich Internet Application Workshop Day 2
Adobe Flex - Developing Rich Internet Application Workshop Day 2Adobe Flex - Developing Rich Internet Application Workshop Day 2
Adobe Flex - Developing Rich Internet Application Workshop Day 2
 
Adobe Flex - Developing Rich Internet Application Workshop Day 2
Adobe Flex - Developing Rich Internet Application Workshop Day 2Adobe Flex - Developing Rich Internet Application Workshop Day 2
Adobe Flex - Developing Rich Internet Application Workshop Day 2
 
Accessibility and ucd
Accessibility and ucdAccessibility and ucd
Accessibility and ucd
 
Android Design
Android DesignAndroid Design
Android Design
 
Mobile UI and Usability Guidelines V1
Mobile UI and Usability Guidelines V1Mobile UI and Usability Guidelines V1
Mobile UI and Usability Guidelines V1
 
Mobile Web Frameworks
Mobile Web FrameworksMobile Web Frameworks
Mobile Web Frameworks
 
iPhone application development training day 1
iPhone application development training day 1iPhone application development training day 1
iPhone application development training day 1
 
Usability Testing
Usability TestingUsability Testing
Usability Testing
 
Json
JsonJson
Json
 
Ethenographic research
Ethenographic researchEthenographic research
Ethenographic research
 
Universal Design
Universal DesignUniversal Design
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