SlideShare une entreprise Scribd logo
1  sur  16
Télécharger pour lire hors ligne
Responsive Images
in 10 minutes
Responsive
Images Responsi
ve
Images
Resp
onsiv
e
Image
s
Screen Size.
Pixel Density. Image Focus.
Layout.
Bonus: Art direction..
http://www.panmacmillan.com/
Flipboard does Responsive really well..
http://engineering.flipboard.com/2014/03/web-layouts/
What are the options?
● Don’t do anything*
● Use the srcset attribute
● Use the Picture element
● Use SVG (the Clown Car technique)
● Use Javascript
Do nothing*
Link: http://fluidity.sexy/
Available for: Everything*
Pros: Makes every default element ‘fluid’ by default. Mobile first?
Cons: It’s still loading the same resources on any platform. Doesn’t really solve
the underlying issue, but it’s a cheap hack.
img,canvas,iframe,video,svg {
max-width:100%
}
.overflow-container {
overflow-y:scroll;
-webkit-overflow-scrolling:touch
}
srcset attribute
Useful links: http://longhandpixels.net/blog/2013/09/responsive-images-srcset
Available for: Chrome desktop, Safari desktop
Pros: Graceful degradation to src attribute.
Cons: Polyfill = loading 2 files, Doesn’t solve every problem.
Polyfill: https://github.com/JimBobSquarePants/srcset-polyfill
picture element
Useful links: http://html5hub.com/html5-picture-element/
Pros: More flexible than srcset, taps directly into media queries
Cons: Spec isn’t final, so not production ready.
Polyfill: https://github.com/scottjehl/picturefill
SVG (the Clown Car technique)
http://coding.smashingmagazine.com/2013/06/02/clown-car-technique-solving-
for-adaptive-images-in-responsive-web-design/
Available for: Chrome, Firefox, Safari, IE9+
Pros: Widely supported, now. Gracefully degrades. Full media query support.
Solves art direction issues.
Cons: Fugly markup. Creation is really complex.
Javascript
Available for: Everything*
Pros:
● Works everywhere*.
● Effective if you use data-attributes, or polyfill-type approach.
● Allows you to combine art-direction data with image resources.
Cons:
● Needs an accessible fallback, which means loading more images.
● Doing things with Javascript is less efficient than having the browser do the
same task, and it’s also slower.
● It can be render-blocking.
● It can’t detect network quality.
So, the future.
Is the <picture> element.
Media queries & multiple sources,
without messy syntax.
But what about now?
Use srcset + polyfill
But avoid making multiple requests.
(consider using it only for desktop resolutions)
What about SVG?
If we could make them easier to manage,
I’d say use them all the time.
Responsive Icons
Iconic: SVG is really freakin’ cool.
https://useiconic.com/tour/

Contenu connexe

Tendances

Android development War Stories
Android development War StoriesAndroid development War Stories
Android development War Stories
Lope Emano
 
Prototyping app using JS and HTML5 (Ciklum Kharkiv)
Prototyping app using JS and HTML5 (Ciklum Kharkiv)Prototyping app using JS and HTML5 (Ciklum Kharkiv)
Prototyping app using JS and HTML5 (Ciklum Kharkiv)
Yuriy Silvestrov
 

Tendances (20)

JHipster presentation by Gaetan Bloch
JHipster presentation by Gaetan BlochJHipster presentation by Gaetan Bloch
JHipster presentation by Gaetan Bloch
 
Hacking the Mid-End (Great Lakes Ruby Bash Edition)
Hacking the Mid-End (Great Lakes Ruby Bash Edition)Hacking the Mid-End (Great Lakes Ruby Bash Edition)
Hacking the Mid-End (Great Lakes Ruby Bash Edition)
 
Get along with JHipster
Get along with JHipsterGet along with JHipster
Get along with JHipster
 
Desktop, Web e Mobile
Desktop, Web e MobileDesktop, Web e Mobile
Desktop, Web e Mobile
 
Passionate People Meetup - React vs Vue with a deepdive into Proxies
Passionate People Meetup - React vs Vue with a deepdive into ProxiesPassionate People Meetup - React vs Vue with a deepdive into Proxies
Passionate People Meetup - React vs Vue with a deepdive into Proxies
 
Beyond responsive design - UI for the modern web application
Beyond responsive design - UI for the modern web applicationBeyond responsive design - UI for the modern web application
Beyond responsive design - UI for the modern web application
 
3d web
3d web3d web
3d web
 
Build Your Blazing Fast Site with Gatsby and WordPress @ WordSesh by Muhammad...
Build Your Blazing Fast Site with Gatsby and WordPress @ WordSesh by Muhammad...Build Your Blazing Fast Site with Gatsby and WordPress @ WordSesh by Muhammad...
Build Your Blazing Fast Site with Gatsby and WordPress @ WordSesh by Muhammad...
 
Real-Time Multi-Device Theming
Real-Time Multi-Device ThemingReal-Time Multi-Device Theming
Real-Time Multi-Device Theming
 
GWT Architectures and Lessons Learned (WJAX 2013)
GWT Architectures and Lessons Learned (WJAX 2013)GWT Architectures and Lessons Learned (WJAX 2013)
GWT Architectures and Lessons Learned (WJAX 2013)
 
xPad - Building Simple Tablet OS with Gtk/WebKit
xPad - Building Simple Tablet OS with Gtk/WebKitxPad - Building Simple Tablet OS with Gtk/WebKit
xPad - Building Simple Tablet OS with Gtk/WebKit
 
Android development War Stories
Android development War StoriesAndroid development War Stories
Android development War Stories
 
Academy PRO: HTML5 API graphics
Academy PRO: HTML5 API graphicsAcademy PRO: HTML5 API graphics
Academy PRO: HTML5 API graphics
 
How to create high scalable JavaScript apps for Java Portals
How to create high scalable JavaScript apps for Java PortalsHow to create high scalable JavaScript apps for Java Portals
How to create high scalable JavaScript apps for Java Portals
 
從一個超簡單範例開始學習 Canvas
從一個超簡單範例開始學習 Canvas從一個超簡單範例開始學習 Canvas
從一個超簡單範例開始學習 Canvas
 
Android
AndroidAndroid
Android
 
CSS vs. JavaScript - Trust vs. Control
CSS vs. JavaScript - Trust vs. ControlCSS vs. JavaScript - Trust vs. Control
CSS vs. JavaScript - Trust vs. Control
 
Using PhantomJS to keep product screenshots up to date
Using PhantomJS to keep product screenshots up to dateUsing PhantomJS to keep product screenshots up to date
Using PhantomJS to keep product screenshots up to date
 
Quick prototyping apps using JS - Ciklum, Vinnitsa
Quick prototyping apps using JS - Ciklum, VinnitsaQuick prototyping apps using JS - Ciklum, Vinnitsa
Quick prototyping apps using JS - Ciklum, Vinnitsa
 
Prototyping app using JS and HTML5 (Ciklum Kharkiv)
Prototyping app using JS and HTML5 (Ciklum Kharkiv)Prototyping app using JS and HTML5 (Ciklum Kharkiv)
Prototyping app using JS and HTML5 (Ciklum Kharkiv)
 

Similaire à Responsive images in 10 minutes

Ilya Ivanov - Advanced React-Native
Ilya Ivanov - Advanced React-NativeIlya Ivanov - Advanced React-Native
Ilya Ivanov - Advanced React-Native
OdessaJS Conf
 
Responsive web design & mobile web development - a technical and business app...
Responsive web design & mobile web development - a technical and business app...Responsive web design & mobile web development - a technical and business app...
Responsive web design & mobile web development - a technical and business app...
Atos_Worldline
 
How I came to build a prototype for mobile develop
How I came to build a prototype for mobile developHow I came to build a prototype for mobile develop
How I came to build a prototype for mobile develop
Rice Tseng
 
Web app and more
Web app and moreWeb app and more
Web app and more
faming su
 

Similaire à Responsive images in 10 minutes (20)

Ilya Ivanov - Advanced React-Native
Ilya Ivanov - Advanced React-NativeIlya Ivanov - Advanced React-Native
Ilya Ivanov - Advanced React-Native
 
Make your animations perform well - Anna Migas - Codemotion Rome 2017
Make your animations perform well - Anna Migas - Codemotion Rome 2017Make your animations perform well - Anna Migas - Codemotion Rome 2017
Make your animations perform well - Anna Migas - Codemotion Rome 2017
 
Responsive websites. Toolbox
Responsive websites. ToolboxResponsive websites. Toolbox
Responsive websites. Toolbox
 
Fake it 'til you make it
Fake it 'til you make itFake it 'til you make it
Fake it 'til you make it
 
Disassembling the Monolith: Taming Large Software Projects with Node.js
Disassembling the Monolith: Taming Large Software Projects with Node.jsDisassembling the Monolith: Taming Large Software Projects with Node.js
Disassembling the Monolith: Taming Large Software Projects with Node.js
 
Eye candy for your iPhone
Eye candy for your iPhoneEye candy for your iPhone
Eye candy for your iPhone
 
Responsive web design & mobile web development - a technical and business app...
Responsive web design & mobile web development - a technical and business app...Responsive web design & mobile web development - a technical and business app...
Responsive web design & mobile web development - a technical and business app...
 
Skill Session - Web Multi Device
Skill Session - Web Multi DeviceSkill Session - Web Multi Device
Skill Session - Web Multi Device
 
Drupalcon Asia - "Drupal 8 Mobile in its DNA"
Drupalcon Asia - "Drupal 8 Mobile in its DNA"Drupalcon Asia - "Drupal 8 Mobile in its DNA"
Drupalcon Asia - "Drupal 8 Mobile in its DNA"
 
Rich Media Advertising with SVG and JavaScript
Rich Media Advertising with SVG and JavaScriptRich Media Advertising with SVG and JavaScript
Rich Media Advertising with SVG and JavaScript
 
How I came to build a prototype for mobile develop
How I came to build a prototype for mobile developHow I came to build a prototype for mobile develop
How I came to build a prototype for mobile develop
 
Delivering Optimal Images for Phones and Tablets on the Modern Web
Delivering Optimal Images for Phones and Tablets on the Modern WebDelivering Optimal Images for Phones and Tablets on the Modern Web
Delivering Optimal Images for Phones and Tablets on the Modern Web
 
Make your animations perform well
Make your animations perform wellMake your animations perform well
Make your animations perform well
 
Html 5 mobile - nitty gritty
Html 5 mobile - nitty grittyHtml 5 mobile - nitty gritty
Html 5 mobile - nitty gritty
 
HalfStack London - Make Your Animations Perform Well
HalfStack London - Make Your Animations Perform Well HalfStack London - Make Your Animations Perform Well
HalfStack London - Make Your Animations Perform Well
 
React Native: Introduction
React Native: IntroductionReact Native: Introduction
React Native: Introduction
 
Active Web Development
Active Web DevelopmentActive Web Development
Active Web Development
 
Web Apps and more
Web Apps and moreWeb Apps and more
Web Apps and more
 
Web app and more
Web app and moreWeb app and more
Web app and more
 
Progressive Web Apps – the return of the web? Goto Berlin 2016
Progressive Web Apps – the return of the web? Goto Berlin 2016Progressive Web Apps – the return of the web? Goto Berlin 2016
Progressive Web Apps – the return of the web? Goto Berlin 2016
 

Plus de James Ford

The Flash Facebook Cookbook - FlashMidlands
The Flash Facebook Cookbook - FlashMidlandsThe Flash Facebook Cookbook - FlashMidlands
The Flash Facebook Cookbook - FlashMidlands
James Ford
 

Plus de James Ford (13)

Virtualisation - Vagrant and Docker
Virtualisation - Vagrant and DockerVirtualisation - Vagrant and Docker
Virtualisation - Vagrant and Docker
 
The Magic of Charts
The Magic of ChartsThe Magic of Charts
The Magic of Charts
 
Telling Tales and Solving Crimes with New Relic
Telling Tales and Solving Crimes with New RelicTelling Tales and Solving Crimes with New Relic
Telling Tales and Solving Crimes with New Relic
 
ES6, WTF?
ES6, WTF?ES6, WTF?
ES6, WTF?
 
Web fonts FTW
Web fonts FTWWeb fonts FTW
Web fonts FTW
 
Git 101: Force-sensitive to Jedi padawan
Git 101: Force-sensitive to Jedi padawanGit 101: Force-sensitive to Jedi padawan
Git 101: Force-sensitive to Jedi padawan
 
'Hack to the future' - Hackathons at MMT Digital
'Hack to the future' - Hackathons at MMT Digital'Hack to the future' - Hackathons at MMT Digital
'Hack to the future' - Hackathons at MMT Digital
 
Fork me!
Fork me!Fork me!
Fork me!
 
Grunt training deck
Grunt training deckGrunt training deck
Grunt training deck
 
What the HTML? - The Holy Grail
What the HTML? - The Holy GrailWhat the HTML? - The Holy Grail
What the HTML? - The Holy Grail
 
Testacular
TestacularTestacular
Testacular
 
Agile Partners
Agile PartnersAgile Partners
Agile Partners
 
The Flash Facebook Cookbook - FlashMidlands
The Flash Facebook Cookbook - FlashMidlandsThe Flash Facebook Cookbook - FlashMidlands
The Flash Facebook Cookbook - FlashMidlands
 

Dernier

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
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
giselly40
 

Dernier (20)

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
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
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...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
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...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
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
 
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
 
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...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
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
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 

Responsive images in 10 minutes

  • 1. Responsive Images in 10 minutes Responsive Images Responsi ve Images Resp onsiv e Image s
  • 2. Screen Size. Pixel Density. Image Focus. Layout.
  • 4. Flipboard does Responsive really well.. http://engineering.flipboard.com/2014/03/web-layouts/
  • 5. What are the options? ● Don’t do anything* ● Use the srcset attribute ● Use the Picture element ● Use SVG (the Clown Car technique) ● Use Javascript
  • 6. Do nothing* Link: http://fluidity.sexy/ Available for: Everything* Pros: Makes every default element ‘fluid’ by default. Mobile first? Cons: It’s still loading the same resources on any platform. Doesn’t really solve the underlying issue, but it’s a cheap hack. img,canvas,iframe,video,svg { max-width:100% } .overflow-container { overflow-y:scroll; -webkit-overflow-scrolling:touch }
  • 7. srcset attribute Useful links: http://longhandpixels.net/blog/2013/09/responsive-images-srcset Available for: Chrome desktop, Safari desktop Pros: Graceful degradation to src attribute. Cons: Polyfill = loading 2 files, Doesn’t solve every problem. Polyfill: https://github.com/JimBobSquarePants/srcset-polyfill
  • 8. picture element Useful links: http://html5hub.com/html5-picture-element/ Pros: More flexible than srcset, taps directly into media queries Cons: Spec isn’t final, so not production ready. Polyfill: https://github.com/scottjehl/picturefill
  • 9. SVG (the Clown Car technique) http://coding.smashingmagazine.com/2013/06/02/clown-car-technique-solving- for-adaptive-images-in-responsive-web-design/ Available for: Chrome, Firefox, Safari, IE9+ Pros: Widely supported, now. Gracefully degrades. Full media query support. Solves art direction issues. Cons: Fugly markup. Creation is really complex.
  • 10. Javascript Available for: Everything* Pros: ● Works everywhere*. ● Effective if you use data-attributes, or polyfill-type approach. ● Allows you to combine art-direction data with image resources. Cons: ● Needs an accessible fallback, which means loading more images. ● Doing things with Javascript is less efficient than having the browser do the same task, and it’s also slower. ● It can be render-blocking. ● It can’t detect network quality.
  • 12. Is the <picture> element. Media queries & multiple sources, without messy syntax.
  • 14. Use srcset + polyfill But avoid making multiple requests. (consider using it only for desktop resolutions)
  • 15. What about SVG? If we could make them easier to manage, I’d say use them all the time.
  • 16. Responsive Icons Iconic: SVG is really freakin’ cool. https://useiconic.com/tour/