SlideShare a Scribd company logo
1 of 14
CSS Sprites & Rollovers
CSS Sprites
CSS Sprites - History


The origin of the term "sprites" comes from old school
computer graphics and the video game industry. The idea
was that the computer could fetch a graphic into
memory, and then only display parts of that image at a
time, which was faster than having to continually fetch new
images. The sprite was the big combined graphic. CSS
Sprites is pretty much the exact same theory: get the image
once, shift it around and only display parts of it, saves the
overhead of having to fetch multiple images.

http://css-tricks.com/css-sprites
CSS Sprites - History



In 2004, Dave Shea suggested a simple CSS-based
approach to CSS sprites based on the practice
established by those legendary video games. In this
case, multiple images used throughout a website
would be combined into the so-called “master
image.” To display a single image from the master
image, one would use the background-position
property in CSS, defining the exact position of the
image to be displayed. Any hover, active or focus
effects would be implemented using the simple
definition of the background-position property for the
displayed element.

http://coding.smashingmagazine.com/2009/04/27/the-mystery-of-
css-sprites-techniques-tools-and-tutorials/
When the page is loaded, it would not load single
images one by one (nor hover-state images per
request), but would rather load the whole master image
at once. It may not sound like a significant
improvement, but it actually was: the main
disadvantage of the onMouse effects is that JavaScript-
based hover effects require two HTTP requests for
each image, which takes time and creates that
unpleasant “flickering” of images. Because the master
image is loaded with the whole page only once with
CSS sprites, no additional HTTP requests are needed
for hover, active or focus effects (because the image is
already loaded), and no “flickering” effect occurs.

http://coding.smashingmagazine.com/2009/04/27/the-mystery-of-css-
sprites-techniques-tools-and-tutorials/
Using the background-position property


 The background-position property defines the initial position of a background-image.




  #star{                                        #star{
  background-image: url(‘star.gif’);            background-image: url(‘star.gif’);
  background-position: 0 0;                     background-position: 20px 20px;
  }                                             }
Using the background-position property


    background-position: [horizontal position] [vertical position];



                                                         20px


                                             20px




  #star{                                 #star{
  background-image: url(‘star.gif’);     background-image: url(‘star.gif’);
  background-position: 0 0;              background-position: 20px 20px;
  }                                      }
Using the background-position property


 The background-position property accepts one or two length values, percentages, or keywords.
 Specify the horizontal position using one of the following keywords: left, center, or right.
 To set the vertical position, the following values are used: top, center, and bottom.



      background-position: left top; /* same as 0% 0% */
      background-position: left center; /* same as 0% 50% */
      background-position: left bottom; /* same as 0% 100% */
      background-position: right top; /* same as 100% 0% */
      background-position: right center; /* same as 100% 50% */
      background-position: right bottom; /* same as 100% 100% */
      background-position: center top; /* same as 50% 0% */
      background-position: center center; /* same as 50% 50% */
      background-position: center bottom; /* same as 50% 100% */
Using the background-position property


    background-position: [horizontal position] [vertical position];




  #star{                                 #star{
  background-image: url(‘star.gif’);     background-image: url(‘star.gif’);
  background-position: left top;         background-position: right bottom;
  }                                      }
Using one sprite for multiple divs:
Using one sprite for multiple divs:



                                      Image Sprite:
Using a sprite to create a CSS Rollover



Rollover Example: http://davidwalsh.name/demo/css-sprites.php




                  Inactive
                                                                Rollover
Using a sprite to create a CSS Rollover




                                          The Image:
Using a sprite to create a CSS Rollover




                  Inactive:
                  background-position: 191px 0;




                  Rollover:
                  background-position: 0 0;

More Related Content

Viewers also liked

Burgers tonen lef masterthese definitief 3 h
Burgers tonen lef masterthese definitief 3 hBurgers tonen lef masterthese definitief 3 h
Burgers tonen lef masterthese definitief 3 hMieke Sanden, van der
 
Intro to Inbound: Creating Buyer Personas
Intro to Inbound: Creating Buyer PersonasIntro to Inbound: Creating Buyer Personas
Intro to Inbound: Creating Buyer Personaskyasi
 
Kgigroep luchlezing rochdale 2 d
Kgigroep luchlezing rochdale 2 dKgigroep luchlezing rochdale 2 d
Kgigroep luchlezing rochdale 2 dQuietroom Label
 
Od webcast-cloud-fraud final
Od webcast-cloud-fraud finalOd webcast-cloud-fraud final
Od webcast-cloud-fraud finalOracleIDM
 
Decisão de Celso de Mello de manter Moreira Franco
Decisão de Celso de Mello de manter Moreira FrancoDecisão de Celso de Mello de manter Moreira Franco
Decisão de Celso de Mello de manter Moreira FrancoMiguel Rosario
 
CSS3 Transitions
CSS3 TransitionsCSS3 Transitions
CSS3 Transitionshstryk
 
F93 b6662 b39f-4cf6-9d0cf8fc4b38800a
F93 b6662 b39f-4cf6-9d0cf8fc4b38800aF93 b6662 b39f-4cf6-9d0cf8fc4b38800a
F93 b6662 b39f-4cf6-9d0cf8fc4b38800aCarlos Carvalho
 
Inadimplência do consumidor, professor Samy Dana.
Inadimplência do consumidor, professor Samy Dana.Inadimplência do consumidor, professor Samy Dana.
Inadimplência do consumidor, professor Samy Dana.FGV-EAESP
 
Клубная встреча 25.12.2016 Итоги 2016 года
Клубная встреча 25.12.2016 Итоги 2016 годаКлубная встреча 25.12.2016 Итоги 2016 года
Клубная встреча 25.12.2016 Итоги 2016 годаЕлена Шальнова
 
Interactive Reader + Foldable
Interactive Reader  + FoldableInteractive Reader  + Foldable
Interactive Reader + Foldablejmori1
 
Indigenous Partnership in Action – Report on International Workshop on Indige...
Indigenous Partnership in Action – Report on International Workshop on Indige...Indigenous Partnership in Action – Report on International Workshop on Indige...
Indigenous Partnership in Action – Report on International Workshop on Indige...Wayne Dunn
 
Presentación de informatica (2014)
Presentación de informatica (2014)Presentación de informatica (2014)
Presentación de informatica (2014)MiCIBERauLaX PC
 
Element Booklet
Element BookletElement Booklet
Element Bookletjmori1
 
Современные представления о структуре дыхательного центра
Современные представления о структуре дыхательного центраСовременные представления о структуре дыхательного центра
Современные представления о структуре дыхательного центраcrasgmu
 

Viewers also liked (20)

Burgers tonen lef masterthese definitief 3 h
Burgers tonen lef masterthese definitief 3 hBurgers tonen lef masterthese definitief 3 h
Burgers tonen lef masterthese definitief 3 h
 
Intro to Inbound: Creating Buyer Personas
Intro to Inbound: Creating Buyer PersonasIntro to Inbound: Creating Buyer Personas
Intro to Inbound: Creating Buyer Personas
 
Kgigroep luchlezing rochdale 2 d
Kgigroep luchlezing rochdale 2 dKgigroep luchlezing rochdale 2 d
Kgigroep luchlezing rochdale 2 d
 
Od webcast-cloud-fraud final
Od webcast-cloud-fraud finalOd webcast-cloud-fraud final
Od webcast-cloud-fraud final
 
2011 2012 annual report
2011 2012 annual report2011 2012 annual report
2011 2012 annual report
 
Decisão de Celso de Mello de manter Moreira Franco
Decisão de Celso de Mello de manter Moreira FrancoDecisão de Celso de Mello de manter Moreira Franco
Decisão de Celso de Mello de manter Moreira Franco
 
Клубная встреча 13112016
Клубная встреча 13112016Клубная встреча 13112016
Клубная встреча 13112016
 
CSS3 Transitions
CSS3 TransitionsCSS3 Transitions
CSS3 Transitions
 
F93 b6662 b39f-4cf6-9d0cf8fc4b38800a
F93 b6662 b39f-4cf6-9d0cf8fc4b38800aF93 b6662 b39f-4cf6-9d0cf8fc4b38800a
F93 b6662 b39f-4cf6-9d0cf8fc4b38800a
 
AEF4 2C 1
AEF4 2C 1AEF4 2C 1
AEF4 2C 1
 
Inadimplência do consumidor, professor Samy Dana.
Inadimplência do consumidor, professor Samy Dana.Inadimplência do consumidor, professor Samy Dana.
Inadimplência do consumidor, professor Samy Dana.
 
Клубная встреча 25.12.2016 Итоги 2016 года
Клубная встреча 25.12.2016 Итоги 2016 годаКлубная встреча 25.12.2016 Итоги 2016 года
Клубная встреча 25.12.2016 Итоги 2016 года
 
68 avenue Gurgaon 7428424386
68 avenue Gurgaon 742842438668 avenue Gurgaon 7428424386
68 avenue Gurgaon 7428424386
 
Interactive Reader + Foldable
Interactive Reader  + FoldableInteractive Reader  + Foldable
Interactive Reader + Foldable
 
Guide leaving your small business
Guide leaving your small businessGuide leaving your small business
Guide leaving your small business
 
Indigenous Partnership in Action – Report on International Workshop on Indige...
Indigenous Partnership in Action – Report on International Workshop on Indige...Indigenous Partnership in Action – Report on International Workshop on Indige...
Indigenous Partnership in Action – Report on International Workshop on Indige...
 
Presentación de informatica (2014)
Presentación de informatica (2014)Presentación de informatica (2014)
Presentación de informatica (2014)
 
Element Booklet
Element BookletElement Booklet
Element Booklet
 
Современные представления о структуре дыхательного центра
Современные представления о структуре дыхательного центраСовременные представления о структуре дыхательного центра
Современные представления о структуре дыхательного центра
 
SETT2014 PDF
SETT2014 PDFSETT2014 PDF
SETT2014 PDF
 

Similar to Sprites rollovers

16- Learn CSS Fundamentals / Background
16- Learn CSS Fundamentals / Background16- Learn CSS Fundamentals / Background
16- Learn CSS Fundamentals / BackgroundIn a Rocket
 
Managing responsive websites with css preprocessors.
Managing responsive websites with css preprocessors. Managing responsive websites with css preprocessors.
Managing responsive websites with css preprocessors. The University of Akron
 
The Creative New World of CSS
The Creative New World of CSSThe Creative New World of CSS
The Creative New World of CSSRachel Andrew
 
GOTO Berlin - You can use CSS for that
GOTO Berlin - You can use CSS for thatGOTO Berlin - You can use CSS for that
GOTO Berlin - You can use CSS for thatRachel Andrew
 
Building Reusable SwiftUI Components
Building Reusable SwiftUI ComponentsBuilding Reusable SwiftUI Components
Building Reusable SwiftUI ComponentsPeter Friese
 
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4Erin M. Kidwell
 
From PSD to WordPress Theme: Bringing designs to life
From PSD to WordPress Theme: Bringing designs to lifeFrom PSD to WordPress Theme: Bringing designs to life
From PSD to WordPress Theme: Bringing designs to lifeDerek Christensen
 
PreDevCampSF - CSS3 Tricks
PreDevCampSF - CSS3 TricksPreDevCampSF - CSS3 Tricks
PreDevCampSF - CSS3 Tricksincidentist
 
Installing And Configuration for your Wordpress blog
Installing And Configuration for your Wordpress blogInstalling And Configuration for your Wordpress blog
Installing And Configuration for your Wordpress blogigorgentry
 
Css sprite_maker-1
Css  sprite_maker-1Css  sprite_maker-1
Css sprite_maker-1lokku
 
CSS3: Are you experienced?
CSS3: Are you experienced?CSS3: Are you experienced?
CSS3: Are you experienced?Denise Jacobs
 
10 CSS Tricks and Tips to Create Astounding Websites
10 CSS Tricks and Tips to Create Astounding Websites10 CSS Tricks and Tips to Create Astounding Websites
10 CSS Tricks and Tips to Create Astounding WebsitesSyntactics Inc.
 
Presentation-1-1.pptx
Presentation-1-1.pptxPresentation-1-1.pptx
Presentation-1-1.pptxIvanPasana
 

Similar to Sprites rollovers (20)

16- Learn CSS Fundamentals / Background
16- Learn CSS Fundamentals / Background16- Learn CSS Fundamentals / Background
16- Learn CSS Fundamentals / Background
 
Managing responsive websites with css preprocessors.
Managing responsive websites with css preprocessors. Managing responsive websites with css preprocessors.
Managing responsive websites with css preprocessors.
 
web page
web pageweb page
web page
 
The Creative New World of CSS
The Creative New World of CSSThe Creative New World of CSS
The Creative New World of CSS
 
GOTO Berlin - You can use CSS for that
GOTO Berlin - You can use CSS for thatGOTO Berlin - You can use CSS for that
GOTO Berlin - You can use CSS for that
 
Building Reusable SwiftUI Components
Building Reusable SwiftUI ComponentsBuilding Reusable SwiftUI Components
Building Reusable SwiftUI Components
 
Revolver
RevolverRevolver
Revolver
 
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
 
From PSD to WordPress Theme: Bringing designs to life
From PSD to WordPress Theme: Bringing designs to lifeFrom PSD to WordPress Theme: Bringing designs to life
From PSD to WordPress Theme: Bringing designs to life
 
PreDevCampSF - CSS3 Tricks
PreDevCampSF - CSS3 TricksPreDevCampSF - CSS3 Tricks
PreDevCampSF - CSS3 Tricks
 
Installing And Configuration for your Wordpress blog
Installing And Configuration for your Wordpress blogInstalling And Configuration for your Wordpress blog
Installing And Configuration for your Wordpress blog
 
Css sprite_maker-1
Css  sprite_maker-1Css  sprite_maker-1
Css sprite_maker-1
 
CSS3: Are you experienced?
CSS3: Are you experienced?CSS3: Are you experienced?
CSS3: Are you experienced?
 
Chapter6
Chapter6Chapter6
Chapter6
 
Drawing images
Drawing imagesDrawing images
Drawing images
 
Css sprite
Css spriteCss sprite
Css sprite
 
Parallax effect in css by Khubaib
Parallax effect in css by KhubaibParallax effect in css by Khubaib
Parallax effect in css by Khubaib
 
10 CSS Tricks and Tips to Create Astounding Websites
10 CSS Tricks and Tips to Create Astounding Websites10 CSS Tricks and Tips to Create Astounding Websites
10 CSS Tricks and Tips to Create Astounding Websites
 
Presentation-1-1.pptx
Presentation-1-1.pptxPresentation-1-1.pptx
Presentation-1-1.pptx
 
Intro to HTML5
Intro to HTML5Intro to HTML5
Intro to HTML5
 

More from hstryk

CSS - Text Properties
CSS - Text PropertiesCSS - Text Properties
CSS - Text Propertieshstryk
 
Lesson 3 - HTML & CSS Part 2
Lesson 3 - HTML & CSS Part 2Lesson 3 - HTML & CSS Part 2
Lesson 3 - HTML & CSS Part 2hstryk
 
Lesson1 - Fall 2013
Lesson1 - Fall 2013Lesson1 - Fall 2013
Lesson1 - Fall 2013hstryk
 
Lesson2
Lesson2Lesson2
Lesson2hstryk
 
CSS Layout Tutorial
CSS Layout TutorialCSS Layout Tutorial
CSS Layout Tutorialhstryk
 
Introduction to CSS3
Introduction to CSS3Introduction to CSS3
Introduction to CSS3hstryk
 
Building a Website from Planning to Photoshop Mockup to HTML/CSS
Building a Website from Planning to Photoshop Mockup to HTML/CSSBuilding a Website from Planning to Photoshop Mockup to HTML/CSS
Building a Website from Planning to Photoshop Mockup to HTML/CSShstryk
 
Lecture4
Lecture4Lecture4
Lecture4hstryk
 
Tutorial1 - Part 2
Tutorial1 - Part 2Tutorial1 - Part 2
Tutorial1 - Part 2hstryk
 
Tutorial1
Tutorial1Tutorial1
Tutorial1hstryk
 
Project1
Project1Project1
Project1hstryk
 
Lesson 3
Lesson 3Lesson 3
Lesson 3hstryk
 
Lesson2
Lesson2Lesson2
Lesson2hstryk
 
Lesson1
Lesson1Lesson1
Lesson1hstryk
 
Heather Strycharz - Resume
Heather Strycharz - ResumeHeather Strycharz - Resume
Heather Strycharz - Resumehstryk
 

More from hstryk (15)

CSS - Text Properties
CSS - Text PropertiesCSS - Text Properties
CSS - Text Properties
 
Lesson 3 - HTML & CSS Part 2
Lesson 3 - HTML & CSS Part 2Lesson 3 - HTML & CSS Part 2
Lesson 3 - HTML & CSS Part 2
 
Lesson1 - Fall 2013
Lesson1 - Fall 2013Lesson1 - Fall 2013
Lesson1 - Fall 2013
 
Lesson2
Lesson2Lesson2
Lesson2
 
CSS Layout Tutorial
CSS Layout TutorialCSS Layout Tutorial
CSS Layout Tutorial
 
Introduction to CSS3
Introduction to CSS3Introduction to CSS3
Introduction to CSS3
 
Building a Website from Planning to Photoshop Mockup to HTML/CSS
Building a Website from Planning to Photoshop Mockup to HTML/CSSBuilding a Website from Planning to Photoshop Mockup to HTML/CSS
Building a Website from Planning to Photoshop Mockup to HTML/CSS
 
Lecture4
Lecture4Lecture4
Lecture4
 
Tutorial1 - Part 2
Tutorial1 - Part 2Tutorial1 - Part 2
Tutorial1 - Part 2
 
Tutorial1
Tutorial1Tutorial1
Tutorial1
 
Project1
Project1Project1
Project1
 
Lesson 3
Lesson 3Lesson 3
Lesson 3
 
Lesson2
Lesson2Lesson2
Lesson2
 
Lesson1
Lesson1Lesson1
Lesson1
 
Heather Strycharz - Resume
Heather Strycharz - ResumeHeather Strycharz - Resume
Heather Strycharz - Resume
 

Recently uploaded

Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 

Recently uploaded (20)

Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 

Sprites rollovers

  • 1. CSS Sprites & Rollovers
  • 3. CSS Sprites - History The origin of the term "sprites" comes from old school computer graphics and the video game industry. The idea was that the computer could fetch a graphic into memory, and then only display parts of that image at a time, which was faster than having to continually fetch new images. The sprite was the big combined graphic. CSS Sprites is pretty much the exact same theory: get the image once, shift it around and only display parts of it, saves the overhead of having to fetch multiple images. http://css-tricks.com/css-sprites
  • 4. CSS Sprites - History In 2004, Dave Shea suggested a simple CSS-based approach to CSS sprites based on the practice established by those legendary video games. In this case, multiple images used throughout a website would be combined into the so-called “master image.” To display a single image from the master image, one would use the background-position property in CSS, defining the exact position of the image to be displayed. Any hover, active or focus effects would be implemented using the simple definition of the background-position property for the displayed element. http://coding.smashingmagazine.com/2009/04/27/the-mystery-of- css-sprites-techniques-tools-and-tutorials/
  • 5. When the page is loaded, it would not load single images one by one (nor hover-state images per request), but would rather load the whole master image at once. It may not sound like a significant improvement, but it actually was: the main disadvantage of the onMouse effects is that JavaScript- based hover effects require two HTTP requests for each image, which takes time and creates that unpleasant “flickering” of images. Because the master image is loaded with the whole page only once with CSS sprites, no additional HTTP requests are needed for hover, active or focus effects (because the image is already loaded), and no “flickering” effect occurs. http://coding.smashingmagazine.com/2009/04/27/the-mystery-of-css- sprites-techniques-tools-and-tutorials/
  • 6. Using the background-position property The background-position property defines the initial position of a background-image. #star{ #star{ background-image: url(‘star.gif’); background-image: url(‘star.gif’); background-position: 0 0; background-position: 20px 20px; } }
  • 7. Using the background-position property background-position: [horizontal position] [vertical position]; 20px 20px #star{ #star{ background-image: url(‘star.gif’); background-image: url(‘star.gif’); background-position: 0 0; background-position: 20px 20px; } }
  • 8. Using the background-position property The background-position property accepts one or two length values, percentages, or keywords. Specify the horizontal position using one of the following keywords: left, center, or right. To set the vertical position, the following values are used: top, center, and bottom. background-position: left top; /* same as 0% 0% */ background-position: left center; /* same as 0% 50% */ background-position: left bottom; /* same as 0% 100% */ background-position: right top; /* same as 100% 0% */ background-position: right center; /* same as 100% 50% */ background-position: right bottom; /* same as 100% 100% */ background-position: center top; /* same as 50% 0% */ background-position: center center; /* same as 50% 50% */ background-position: center bottom; /* same as 50% 100% */
  • 9. Using the background-position property background-position: [horizontal position] [vertical position]; #star{ #star{ background-image: url(‘star.gif’); background-image: url(‘star.gif’); background-position: left top; background-position: right bottom; } }
  • 10. Using one sprite for multiple divs:
  • 11. Using one sprite for multiple divs: Image Sprite:
  • 12. Using a sprite to create a CSS Rollover Rollover Example: http://davidwalsh.name/demo/css-sprites.php Inactive Rollover
  • 13. Using a sprite to create a CSS Rollover The Image:
  • 14. Using a sprite to create a CSS Rollover Inactive: background-position: 191px 0; Rollover: background-position: 0 0;