SlideShare a Scribd company logo
1 of 33
Download to read offline
Responsive Web In Brief 
EPAM Ukraine, 2014, oleg_gomozov@epam.com
About me 
•7 years in IT 
•.NET background 
•JS and Front-End with mobile applications expertise 
•Tech trainer for EPAM JS Labs
Choose yours: flexible, fluid, adaptive, responsive
•Flexible–change size, scale 
•Fluid–flexible + grid or some layout rules 
•Adaptive–fluid + change in content, UI elements face and appearance 
•Responsive –adaptive + change of interface, behavior, interactions, device and human specifics
Some info about units
Flexible measurements 
<bodystyle=“margin: 0auto;”> 
<header>Header text 
<span>Small text</span> 
</header> 
</body> 
From pixel to em: 
target / context = result 
for “header”: 
target = 24px 
context = 16px (base font size per browser) 
result = 24px / 16px = 1.5em 
for “header” –>“span”: 
target = 14px 
context = 24px (header font size) 
result = 14px / 24px = 0.583333333em
Flexible grid-based layout
From pixel to % 
target / context = result 
for “header”: 
target = 900px (body size) 
context = 1024px (window screen size) 
result = 900px / 1024px = 87.890675%
Other unitsrem –like em, but only body is contextvw, vh–viewport width and height (in %) dw, dh –device width and height (in %)
Media Queries Magic
@media only screen and (min-device-width : 320px) and 
(max-device-width : 480px) { 
/* Styles */ 
} 
@media only screen and (min-device-width : 768px) and 
(max-device-width : 1024px) and (orientation : landscape) { 
/* Styles */ 
} 
@media only screen and (min-width : 1224px) { 
/* Styles */ 
} 
<link rel='stylesheet'media='screen and (min-width: 701px) and 
(max-width: 900px)'href='css/medium.css'/>
Media query properties 
screen 
orientation 
aspect-ratio (min, max) 
device-height (min, max) 
device-width (min, max) 
device-aspect-ratio (min, max) 
height (min, max) 
width (min, max) 
-webkit-device-pixel-ratio
JavaScript practices
Detect devices, size, specifics 
-window.navigator.userAgent 
-window.height, window.width 
-window.devicePixelRatio
varisChrome=function(){ 
returnnavigator.userAgent.indexOf(“Chrome/”) >=0; 
}; 
varisIphone=function(){ 
returnnavigator.userAgent.indexOf(“iPhone”) >=0; 
}; 
varisTablet=function(){ 
return$(window).width()>1024&& $(window).width()<2048; 
};
$(document).ready(function(){ 
if(isChrome()){ 
$('.left_menu').hide(); 
} 
if(isIphone()){ 
$('body').css('font-size','2em'); 
} 
if(isTablet()){ 
varlogo =document.getElementById('logo'); 
logo.style.backgroundImage= 'url("/images/tablet_logo.png")'; 
$('.right_menu').css('flex','1'); 
$('.left_menu').css('flex','2'); 
$('.content_menu').css('flex','4'); 
}});
matchMedia 
if(window.matchMedia("(min-width: 400px)").matches){ 
/* the view port is at least 400 pixels wide */ 
}else{ 
/* the view port is less than 400 pixels wide */ 
}
Browser, please, help me
Meta viewport and @viewport 
<metaname="viewport"content="width=device- width, initial-scale=1.0, user-scalable=false, 
minimum-scale=0.9, maximum-scale=1.1"> 
Apple-specific meta 
<metaname="apple-mobile-web-app-capable"content="yes"> 
navigator.standalonemode
Mobile first, how and why? 
Desktop is specific device, mobile is basic
Tricks, tools and hacks
http://adaptive-images.com: 
1.The HTML starts to load in the browser and a snippet of JS in the <head> writes a session cookie, storing the visitor's screen size in pixels. 
2.Browser then encounters <img> tag and sends a request to the server for that image. It also sends the browser cookie. 
3.Apache receives the request and looks in the website's .htaccessfile. 
4..htaccess: any request for JPG, GIF, or PNG file send to the adaptive- images.phpfile. 
5.PHP file looks for a cookie and finds user maximum screen size of 480px. 
6.It compares the cookie value with all $resolutionsizes that were configured, and decides which matches best. 
7.Then looks into /ai-cache/480/folder to see if a rescaled image already exists. 
8.If not the PHP then goes to the actual requested URI to find the original file. 
9.It checks image width. If that's smaller than the user's screen width it sends the image. 
10.If it's larger, the PHP creates a down-scaled copy and saves that into the /ai- cache/480/folder ready for the next time it's needed, and sends it to the user.
PictureFill 
<spandata-picture data-alt="A giant stone face"> 
<spandata-src="small.jpg"></span> 
<spandata-src="medium.jpg"data-media="(min-width: 400px)"></span> 
<spandata-src="large.jpg"data-media="(min-width: 800px)"></span> 
<spandata-src="extralarge.jpg"data-media="(min-width: 1000px)"></span> 
<spandata-src="small_x2_retina.jpg" 
data-media="(min-device-pixel-ratio: 2.0)"></span> 
<noscript><imgsrc="small.jpg"alt="A giant stone face"></noscript> 
</span> 
Filepicturefill.jsin<head>changesall<span>’swith“data-picture”attributeto<img>withcorrespondingURLfrominner<span>“data-src”attributeaccordingto“data- media”queryusingwindow.matchMedia.Alsosupportsdefferedloadingcallingwindow.picturefill()
Iconic fonts 
@font-face { 
font-family:'icons'; 
src:url('../fonts/IcoMoon.eot?#')format('eot'), 
url('../fonts/IcoMoon.woff')format('woff'), 
url('../fonts/IcoMoon.ttf')format('truetype'); 
} 
[data-icon]:before { 
font-family:icons; 
content:attr(data-icon); 
} 
<h3> 
<spandata-icon="&#x21dd;">Statistycs</span> 
</h3>
Iconic fonts benefits 
•Lossless change size, vector graphics in fonts 
•Change of solid colormask 
•Change of shape, shadow and other text transformations
HTML5 Approach 
<picture> 
<source media="(min-width: 64em)"src="high-res.jpg"> 
<source media="(min-width: 37.5em)"src="med-res.jpg"> 
<source src="low-res.jpg"><imgsrc="fallback.jpg"alt="This picture loads on non-supporting browsers."> 
<p>Accessible text.</p> 
</picture> 
picture tag
HTML5 Approach 
-web-kit-image-set 
.selector{ 
background-image:url('../img/image-1x.jpg'; 
background-image:-webkit-image-set(url('../img/image-1x.jpg') 
1x,url('../img/image-2x.jpg')2x); 
}
HTML5 Approach 
<imgsrc="fallback.jpg"srcset="small.jpg 640w 1x, 
small-hd.jpg 640w 2x, large.jpg 1x, large-hd.jpg 2x" 
alt="…"> 
srcset
Proper HTML5 input types 
<form> 
<inputtype="url"placeholder="Go to a Website"autofocus> 
<inputtype="email"required maxlength="12"> 
<inputtype="date"> 
<inputtype="datetime"> 
<inputtype="number"min="0"max="10"step="2"value="6“ 
pattern="[A-Z]{3}[0-9]{4}"> 
<inputtype="color"> 
<inputtype="submit"value="Search"> 
</form>
Pixel is not a pixel 
1 CSS Px= 1 Device Px 
CSS pixel –reference pixels, which are the main measure points for browsers measurements. 
Device pixel –physical pixels, which are the main measure points for device graphics actions. 
Zoom out 
Zoom in 
1 CSS Px= 4 Device Px, 
Retina=)
Prepare for responsive 
-componentsfunction priority 
-target devicesscreens 
-target audience and it’s context
Refs 
•Responsive Web Design, Ethan Marcotte 
•Mobile First, Luke Wroblewski 
•http://cssing.org.ua, YuriyArtyukh 
•http://dev.w3.org/csswg/css-device-adapt/#the-atviewport-rule 
•https://developer.apple.com/library/safari/documentation/AppleApplications/Reference/SafariHTMLRef/Articles/MetaTags.html 
•https://github.com/scottjehl/picturefill 
•http://adaptive-images.com 
•http://www.quirksmode.org/mobile/viewports2.html 
•http://www.quirksmode.org/blog/archives/2010/04/a_pixel_is_not.html 
•http://www.w3.org/TR/wai-aria/ 
•http://designinstruct.com/roundups/html5-frameworks/ 
•http://mashable.com/2013/04/26/css-boilerplates-frameworks/ 
•http://www.ted.com/talks/simon_sinek_how_great_leaders_inspire_action.html
The end

More Related Content

What's hot

Responsive Images in the Real World - presented at JavaScript Open 2015
Responsive Images in the Real World - presented at JavaScript Open 2015Responsive Images in the Real World - presented at JavaScript Open 2015
Responsive Images in the Real World - presented at JavaScript Open 2015Morten Rand-Hendriksen
 
Device aware web frameworks for better programming
Device aware web frameworks for better programmingDevice aware web frameworks for better programming
Device aware web frameworks for better programmingSuntae Kim
 
Yes, browsers can do that! Hybrid and future web meetup at Jayway
Yes, browsers can do that! Hybrid and future web meetup at JaywayYes, browsers can do that! Hybrid and future web meetup at Jayway
Yes, browsers can do that! Hybrid and future web meetup at JaywayChristian Heilmann
 
Once Source to Rule Them All
Once Source to Rule Them AllOnce Source to Rule Them All
Once Source to Rule Them AllDavid Yeiser
 
Responsive Design: Mehr als CSS
Responsive Design: Mehr als CSSResponsive Design: Mehr als CSS
Responsive Design: Mehr als CSSWalter Ebert
 
AngularJS: The Bridge Between Today and Tomorrow's Web (Todd Motto)
AngularJS: The Bridge Between Today and Tomorrow's Web (Todd Motto)AngularJS: The Bridge Between Today and Tomorrow's Web (Todd Motto)
AngularJS: The Bridge Between Today and Tomorrow's Web (Todd Motto)Future Insights
 
Library Program Technology in Ukraine & Romania
Library Program Technology in Ukraine & RomaniaLibrary Program Technology in Ukraine & Romania
Library Program Technology in Ukraine & RomaniaMark Belinsky
 
Slides pour blog
Slides pour blogSlides pour blog
Slides pour bloglyago
 
Best Practices for Embedded UA - WritersUA 2012, Scott DeLoach, ClickStart
Best Practices for Embedded UA - WritersUA 2012, Scott DeLoach, ClickStartBest Practices for Embedded UA - WritersUA 2012, Scott DeLoach, ClickStart
Best Practices for Embedded UA - WritersUA 2012, Scott DeLoach, ClickStartScott DeLoach
 
High Performance Images
High Performance ImagesHigh Performance Images
High Performance ImagesWalter Ebert
 
jQuery Mobile - Desenvolvimento para dispositivos móveis
jQuery Mobile - Desenvolvimento para dispositivos móveisjQuery Mobile - Desenvolvimento para dispositivos móveis
jQuery Mobile - Desenvolvimento para dispositivos móveisPablo Garrido
 

What's hot (18)

Responsive Images in the Real World - presented at JavaScript Open 2015
Responsive Images in the Real World - presented at JavaScript Open 2015Responsive Images in the Real World - presented at JavaScript Open 2015
Responsive Images in the Real World - presented at JavaScript Open 2015
 
Device aware web frameworks for better programming
Device aware web frameworks for better programmingDevice aware web frameworks for better programming
Device aware web frameworks for better programming
 
Jager
JagerJager
Jager
 
Yes, browsers can do that! Hybrid and future web meetup at Jayway
Yes, browsers can do that! Hybrid and future web meetup at JaywayYes, browsers can do that! Hybrid and future web meetup at Jayway
Yes, browsers can do that! Hybrid and future web meetup at Jayway
 
Once Source to Rule Them All
Once Source to Rule Them AllOnce Source to Rule Them All
Once Source to Rule Them All
 
Mi pasión
Mi pasiónMi pasión
Mi pasión
 
Responsive Design: Mehr als CSS
Responsive Design: Mehr als CSSResponsive Design: Mehr als CSS
Responsive Design: Mehr als CSS
 
Embed
EmbedEmbed
Embed
 
AngularJS: The Bridge Between Today and Tomorrow's Web (Todd Motto)
AngularJS: The Bridge Between Today and Tomorrow's Web (Todd Motto)AngularJS: The Bridge Between Today and Tomorrow's Web (Todd Motto)
AngularJS: The Bridge Between Today and Tomorrow's Web (Todd Motto)
 
Library Program Technology in Ukraine & Romania
Library Program Technology in Ukraine & RomaniaLibrary Program Technology in Ukraine & Romania
Library Program Technology in Ukraine & Romania
 
Slides pour blog
Slides pour blogSlides pour blog
Slides pour blog
 
Teste
TesteTeste
Teste
 
Best Practices for Embedded UA - WritersUA 2012, Scott DeLoach, ClickStart
Best Practices for Embedded UA - WritersUA 2012, Scott DeLoach, ClickStartBest Practices for Embedded UA - WritersUA 2012, Scott DeLoach, ClickStart
Best Practices for Embedded UA - WritersUA 2012, Scott DeLoach, ClickStart
 
High Performance Images
High Performance ImagesHigh Performance Images
High Performance Images
 
jQuery Mobile - Desenvolvimento para dispositivos móveis
jQuery Mobile - Desenvolvimento para dispositivos móveisjQuery Mobile - Desenvolvimento para dispositivos móveis
jQuery Mobile - Desenvolvimento para dispositivos móveis
 
Voki
VokiVoki
Voki
 
Responsive and Fast
Responsive and FastResponsive and Fast
Responsive and Fast
 
Bilder usw...
Bilder usw...Bilder usw...
Bilder usw...
 

Similar to Responsive Web in Brief

Pinkoi Mobile Web
Pinkoi Mobile WebPinkoi Mobile Web
Pinkoi Mobile Webmikeleeme
 
Responsive Websites
Responsive WebsitesResponsive Websites
Responsive WebsitesJoe Seifi
 
Adaptive Layouts - standards>next London 28.05.2011
Adaptive Layouts - standards>next London 28.05.2011Adaptive Layouts - standards>next London 28.05.2011
Adaptive Layouts - standards>next London 28.05.2011Patrick Lauke
 
Responsive Web Design e a Ubiquidade da Web
Responsive Web Design e a Ubiquidade da WebResponsive Web Design e a Ubiquidade da Web
Responsive Web Design e a Ubiquidade da WebEduardo Shiota Yasuda
 
[convergese] Adaptive Images in Responsive Web Design
[convergese] Adaptive Images in Responsive Web Design[convergese] Adaptive Images in Responsive Web Design
[convergese] Adaptive Images in Responsive Web DesignChristopher Schmitt
 
Responsive design: techniques and tricks to prepare your websites for the mul...
Responsive design: techniques and tricks to prepare your websites for the mul...Responsive design: techniques and tricks to prepare your websites for the mul...
Responsive design: techniques and tricks to prepare your websites for the mul...Andreas Bovens
 
Adaptive layouts - standards>next Manchester 23.03.2011
Adaptive layouts - standards>next Manchester 23.03.2011Adaptive layouts - standards>next Manchester 23.03.2011
Adaptive layouts - standards>next Manchester 23.03.2011Patrick Lauke
 
Adapt and respond - mobile-friendly layouts beyond the desktop - standards>ne...
Adapt and respond - mobile-friendly layouts beyond the desktop - standards>ne...Adapt and respond - mobile-friendly layouts beyond the desktop - standards>ne...
Adapt and respond - mobile-friendly layouts beyond the desktop - standards>ne...Patrick Lauke
 
[cssdevconf] Adaptive Images in RWD
[cssdevconf] Adaptive Images in RWD[cssdevconf] Adaptive Images in RWD
[cssdevconf] Adaptive Images in RWDChristopher Schmitt
 
Intro to @viewport & other new Responsive Web Design CSS features
Intro to @viewport & other new Responsive Web Design CSS featuresIntro to @viewport & other new Responsive Web Design CSS features
Intro to @viewport & other new Responsive Web Design CSS featuresAndreas Bovens
 
[rwdsummit2012] Adaptive Images in Responsive Web Design
[rwdsummit2012] Adaptive Images in Responsive Web Design[rwdsummit2012] Adaptive Images in Responsive Web Design
[rwdsummit2012] Adaptive Images in Responsive Web DesignChristopher Schmitt
 
[html5tx] Adaptive Images in Responsive Web Design
[html5tx] Adaptive Images in Responsive Web Design[html5tx] Adaptive Images in Responsive Web Design
[html5tx] Adaptive Images in Responsive Web DesignChristopher Schmitt
 
Oleh Zasadnyy "Progressive Web Apps: line between web and native apps become ...
Oleh Zasadnyy "Progressive Web Apps: line between web and native apps become ...Oleh Zasadnyy "Progressive Web Apps: line between web and native apps become ...
Oleh Zasadnyy "Progressive Web Apps: line between web and native apps become ...IT Event
 
Responsive UX - One size fits all @BigDesign conference #BigD12
Responsive UX - One size fits all   @BigDesign conference #BigD12Responsive UX - One size fits all   @BigDesign conference #BigD12
Responsive UX - One size fits all @BigDesign conference #BigD12touchtitans
 
3 Approaches to Mobile - An A to Z Primer.
3 Approaches to Mobile - An A to Z Primer.3 Approaches to Mobile - An A to Z Primer.
3 Approaches to Mobile - An A to Z Primer.agup2009
 
Handys und Tablets - Webentwicklung jenseits des Desktops - WebTech Mainz 12....
Handys und Tablets - Webentwicklung jenseits des Desktops - WebTech Mainz 12....Handys und Tablets - Webentwicklung jenseits des Desktops - WebTech Mainz 12....
Handys und Tablets - Webentwicklung jenseits des Desktops - WebTech Mainz 12....Patrick Lauke
 
Building mobile apps with the ArcGIS api for Javascript, Esri, Andy Gup and A...
Building mobile apps with the ArcGIS api for Javascript, Esri, Andy Gup and A...Building mobile apps with the ArcGIS api for Javascript, Esri, Andy Gup and A...
Building mobile apps with the ArcGIS api for Javascript, Esri, Andy Gup and A...Esri Nederland
 
[HEWEBAR 2012] Adaptive Images in Responsive Web Design
[HEWEBAR 2012] Adaptive Images in Responsive Web Design[HEWEBAR 2012] Adaptive Images in Responsive Web Design
[HEWEBAR 2012] Adaptive Images in Responsive Web DesignChristopher Schmitt
 
[refreshaustin] Adaptive Images in Responsive Web Design
[refreshaustin] Adaptive Images in Responsive Web Design[refreshaustin] Adaptive Images in Responsive Web Design
[refreshaustin] Adaptive Images in Responsive Web DesignChristopher Schmitt
 

Similar to Responsive Web in Brief (20)

Pinkoi Mobile Web
Pinkoi Mobile WebPinkoi Mobile Web
Pinkoi Mobile Web
 
Responsive Websites
Responsive WebsitesResponsive Websites
Responsive Websites
 
Adaptive Layouts - standards>next London 28.05.2011
Adaptive Layouts - standards>next London 28.05.2011Adaptive Layouts - standards>next London 28.05.2011
Adaptive Layouts - standards>next London 28.05.2011
 
Responsive Web Design e a Ubiquidade da Web
Responsive Web Design e a Ubiquidade da WebResponsive Web Design e a Ubiquidade da Web
Responsive Web Design e a Ubiquidade da Web
 
[convergese] Adaptive Images in Responsive Web Design
[convergese] Adaptive Images in Responsive Web Design[convergese] Adaptive Images in Responsive Web Design
[convergese] Adaptive Images in Responsive Web Design
 
Responsive design: techniques and tricks to prepare your websites for the mul...
Responsive design: techniques and tricks to prepare your websites for the mul...Responsive design: techniques and tricks to prepare your websites for the mul...
Responsive design: techniques and tricks to prepare your websites for the mul...
 
Adaptive layouts - standards>next Manchester 23.03.2011
Adaptive layouts - standards>next Manchester 23.03.2011Adaptive layouts - standards>next Manchester 23.03.2011
Adaptive layouts - standards>next Manchester 23.03.2011
 
Responsive design
Responsive designResponsive design
Responsive design
 
Adapt and respond - mobile-friendly layouts beyond the desktop - standards>ne...
Adapt and respond - mobile-friendly layouts beyond the desktop - standards>ne...Adapt and respond - mobile-friendly layouts beyond the desktop - standards>ne...
Adapt and respond - mobile-friendly layouts beyond the desktop - standards>ne...
 
[cssdevconf] Adaptive Images in RWD
[cssdevconf] Adaptive Images in RWD[cssdevconf] Adaptive Images in RWD
[cssdevconf] Adaptive Images in RWD
 
Intro to @viewport & other new Responsive Web Design CSS features
Intro to @viewport & other new Responsive Web Design CSS featuresIntro to @viewport & other new Responsive Web Design CSS features
Intro to @viewport & other new Responsive Web Design CSS features
 
[rwdsummit2012] Adaptive Images in Responsive Web Design
[rwdsummit2012] Adaptive Images in Responsive Web Design[rwdsummit2012] Adaptive Images in Responsive Web Design
[rwdsummit2012] Adaptive Images in Responsive Web Design
 
[html5tx] Adaptive Images in Responsive Web Design
[html5tx] Adaptive Images in Responsive Web Design[html5tx] Adaptive Images in Responsive Web Design
[html5tx] Adaptive Images in Responsive Web Design
 
Oleh Zasadnyy "Progressive Web Apps: line between web and native apps become ...
Oleh Zasadnyy "Progressive Web Apps: line between web and native apps become ...Oleh Zasadnyy "Progressive Web Apps: line between web and native apps become ...
Oleh Zasadnyy "Progressive Web Apps: line between web and native apps become ...
 
Responsive UX - One size fits all @BigDesign conference #BigD12
Responsive UX - One size fits all   @BigDesign conference #BigD12Responsive UX - One size fits all   @BigDesign conference #BigD12
Responsive UX - One size fits all @BigDesign conference #BigD12
 
3 Approaches to Mobile - An A to Z Primer.
3 Approaches to Mobile - An A to Z Primer.3 Approaches to Mobile - An A to Z Primer.
3 Approaches to Mobile - An A to Z Primer.
 
Handys und Tablets - Webentwicklung jenseits des Desktops - WebTech Mainz 12....
Handys und Tablets - Webentwicklung jenseits des Desktops - WebTech Mainz 12....Handys und Tablets - Webentwicklung jenseits des Desktops - WebTech Mainz 12....
Handys und Tablets - Webentwicklung jenseits des Desktops - WebTech Mainz 12....
 
Building mobile apps with the ArcGIS api for Javascript, Esri, Andy Gup and A...
Building mobile apps with the ArcGIS api for Javascript, Esri, Andy Gup and A...Building mobile apps with the ArcGIS api for Javascript, Esri, Andy Gup and A...
Building mobile apps with the ArcGIS api for Javascript, Esri, Andy Gup and A...
 
[HEWEBAR 2012] Adaptive Images in Responsive Web Design
[HEWEBAR 2012] Adaptive Images in Responsive Web Design[HEWEBAR 2012] Adaptive Images in Responsive Web Design
[HEWEBAR 2012] Adaptive Images in Responsive Web Design
 
[refreshaustin] Adaptive Images in Responsive Web Design
[refreshaustin] Adaptive Images in Responsive Web Design[refreshaustin] Adaptive Images in Responsive Web Design
[refreshaustin] Adaptive Images in Responsive Web Design
 

More from EPAM

JavaScript. Code Quality.
JavaScript. Code Quality.JavaScript. Code Quality.
JavaScript. Code Quality.EPAM
 
Continuous integration for JavaScript projects
Continuous integration for JavaScript projectsContinuous integration for JavaScript projects
Continuous integration for JavaScript projectsEPAM
 
Visualization of Big Data in Web Apps
Visualization of Big Data in Web AppsVisualization of Big Data in Web Apps
Visualization of Big Data in Web AppsEPAM
 
Object Oriented Concepts in Real Projects
Object Oriented Concepts in Real ProjectsObject Oriented Concepts in Real Projects
Object Oriented Concepts in Real ProjectsEPAM
 
Modern web applications infrastructure
Modern web applications infrastructureModern web applications infrastructure
Modern web applications infrastructureEPAM
 
Reactive Extensions: classic Observer in .NET
Reactive Extensions: classic Observer in .NETReactive Extensions: classic Observer in .NET
Reactive Extensions: classic Observer in .NETEPAM
 
SOLID Principles in the real world
SOLID Principles in the real worldSOLID Principles in the real world
SOLID Principles in the real worldEPAM
 
Future of the Future of E-Commerce
Future of the Future of E-CommerceFuture of the Future of E-Commerce
Future of the Future of E-CommerceEPAM
 
Bootify Yyour App from Zero to Hero
Bootify Yyour App from Zero to HeroBootify Yyour App from Zero to Hero
Bootify Yyour App from Zero to HeroEPAM
 

More from EPAM (9)

JavaScript. Code Quality.
JavaScript. Code Quality.JavaScript. Code Quality.
JavaScript. Code Quality.
 
Continuous integration for JavaScript projects
Continuous integration for JavaScript projectsContinuous integration for JavaScript projects
Continuous integration for JavaScript projects
 
Visualization of Big Data in Web Apps
Visualization of Big Data in Web AppsVisualization of Big Data in Web Apps
Visualization of Big Data in Web Apps
 
Object Oriented Concepts in Real Projects
Object Oriented Concepts in Real ProjectsObject Oriented Concepts in Real Projects
Object Oriented Concepts in Real Projects
 
Modern web applications infrastructure
Modern web applications infrastructureModern web applications infrastructure
Modern web applications infrastructure
 
Reactive Extensions: classic Observer in .NET
Reactive Extensions: classic Observer in .NETReactive Extensions: classic Observer in .NET
Reactive Extensions: classic Observer in .NET
 
SOLID Principles in the real world
SOLID Principles in the real worldSOLID Principles in the real world
SOLID Principles in the real world
 
Future of the Future of E-Commerce
Future of the Future of E-CommerceFuture of the Future of E-Commerce
Future of the Future of E-Commerce
 
Bootify Yyour App from Zero to Hero
Bootify Yyour App from Zero to HeroBootify Yyour App from Zero to Hero
Bootify Yyour App from Zero to Hero
 

Recently uploaded

MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfLivetecs LLC
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....kzayra69
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 

Recently uploaded (20)

MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdf
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 

Responsive Web in Brief

  • 1. Responsive Web In Brief EPAM Ukraine, 2014, oleg_gomozov@epam.com
  • 2. About me •7 years in IT •.NET background •JS and Front-End with mobile applications expertise •Tech trainer for EPAM JS Labs
  • 3. Choose yours: flexible, fluid, adaptive, responsive
  • 4. •Flexible–change size, scale •Fluid–flexible + grid or some layout rules •Adaptive–fluid + change in content, UI elements face and appearance •Responsive –adaptive + change of interface, behavior, interactions, device and human specifics
  • 6. Flexible measurements <bodystyle=“margin: 0auto;”> <header>Header text <span>Small text</span> </header> </body> From pixel to em: target / context = result for “header”: target = 24px context = 16px (base font size per browser) result = 24px / 16px = 1.5em for “header” –>“span”: target = 14px context = 24px (header font size) result = 14px / 24px = 0.583333333em
  • 8. From pixel to % target / context = result for “header”: target = 900px (body size) context = 1024px (window screen size) result = 900px / 1024px = 87.890675%
  • 9. Other unitsrem –like em, but only body is contextvw, vh–viewport width and height (in %) dw, dh –device width and height (in %)
  • 11. @media only screen and (min-device-width : 320px) and (max-device-width : 480px) { /* Styles */ } @media only screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation : landscape) { /* Styles */ } @media only screen and (min-width : 1224px) { /* Styles */ } <link rel='stylesheet'media='screen and (min-width: 701px) and (max-width: 900px)'href='css/medium.css'/>
  • 12. Media query properties screen orientation aspect-ratio (min, max) device-height (min, max) device-width (min, max) device-aspect-ratio (min, max) height (min, max) width (min, max) -webkit-device-pixel-ratio
  • 14. Detect devices, size, specifics -window.navigator.userAgent -window.height, window.width -window.devicePixelRatio
  • 15. varisChrome=function(){ returnnavigator.userAgent.indexOf(“Chrome/”) >=0; }; varisIphone=function(){ returnnavigator.userAgent.indexOf(“iPhone”) >=0; }; varisTablet=function(){ return$(window).width()>1024&& $(window).width()<2048; };
  • 16. $(document).ready(function(){ if(isChrome()){ $('.left_menu').hide(); } if(isIphone()){ $('body').css('font-size','2em'); } if(isTablet()){ varlogo =document.getElementById('logo'); logo.style.backgroundImage= 'url("/images/tablet_logo.png")'; $('.right_menu').css('flex','1'); $('.left_menu').css('flex','2'); $('.content_menu').css('flex','4'); }});
  • 17. matchMedia if(window.matchMedia("(min-width: 400px)").matches){ /* the view port is at least 400 pixels wide */ }else{ /* the view port is less than 400 pixels wide */ }
  • 19. Meta viewport and @viewport <metaname="viewport"content="width=device- width, initial-scale=1.0, user-scalable=false, minimum-scale=0.9, maximum-scale=1.1"> Apple-specific meta <metaname="apple-mobile-web-app-capable"content="yes"> navigator.standalonemode
  • 20. Mobile first, how and why? Desktop is specific device, mobile is basic
  • 22. http://adaptive-images.com: 1.The HTML starts to load in the browser and a snippet of JS in the <head> writes a session cookie, storing the visitor's screen size in pixels. 2.Browser then encounters <img> tag and sends a request to the server for that image. It also sends the browser cookie. 3.Apache receives the request and looks in the website's .htaccessfile. 4..htaccess: any request for JPG, GIF, or PNG file send to the adaptive- images.phpfile. 5.PHP file looks for a cookie and finds user maximum screen size of 480px. 6.It compares the cookie value with all $resolutionsizes that were configured, and decides which matches best. 7.Then looks into /ai-cache/480/folder to see if a rescaled image already exists. 8.If not the PHP then goes to the actual requested URI to find the original file. 9.It checks image width. If that's smaller than the user's screen width it sends the image. 10.If it's larger, the PHP creates a down-scaled copy and saves that into the /ai- cache/480/folder ready for the next time it's needed, and sends it to the user.
  • 23. PictureFill <spandata-picture data-alt="A giant stone face"> <spandata-src="small.jpg"></span> <spandata-src="medium.jpg"data-media="(min-width: 400px)"></span> <spandata-src="large.jpg"data-media="(min-width: 800px)"></span> <spandata-src="extralarge.jpg"data-media="(min-width: 1000px)"></span> <spandata-src="small_x2_retina.jpg" data-media="(min-device-pixel-ratio: 2.0)"></span> <noscript><imgsrc="small.jpg"alt="A giant stone face"></noscript> </span> Filepicturefill.jsin<head>changesall<span>’swith“data-picture”attributeto<img>withcorrespondingURLfrominner<span>“data-src”attributeaccordingto“data- media”queryusingwindow.matchMedia.Alsosupportsdefferedloadingcallingwindow.picturefill()
  • 24. Iconic fonts @font-face { font-family:'icons'; src:url('../fonts/IcoMoon.eot?#')format('eot'), url('../fonts/IcoMoon.woff')format('woff'), url('../fonts/IcoMoon.ttf')format('truetype'); } [data-icon]:before { font-family:icons; content:attr(data-icon); } <h3> <spandata-icon="&#x21dd;">Statistycs</span> </h3>
  • 25. Iconic fonts benefits •Lossless change size, vector graphics in fonts •Change of solid colormask •Change of shape, shadow and other text transformations
  • 26. HTML5 Approach <picture> <source media="(min-width: 64em)"src="high-res.jpg"> <source media="(min-width: 37.5em)"src="med-res.jpg"> <source src="low-res.jpg"><imgsrc="fallback.jpg"alt="This picture loads on non-supporting browsers."> <p>Accessible text.</p> </picture> picture tag
  • 27. HTML5 Approach -web-kit-image-set .selector{ background-image:url('../img/image-1x.jpg'; background-image:-webkit-image-set(url('../img/image-1x.jpg') 1x,url('../img/image-2x.jpg')2x); }
  • 28. HTML5 Approach <imgsrc="fallback.jpg"srcset="small.jpg 640w 1x, small-hd.jpg 640w 2x, large.jpg 1x, large-hd.jpg 2x" alt="…"> srcset
  • 29. Proper HTML5 input types <form> <inputtype="url"placeholder="Go to a Website"autofocus> <inputtype="email"required maxlength="12"> <inputtype="date"> <inputtype="datetime"> <inputtype="number"min="0"max="10"step="2"value="6“ pattern="[A-Z]{3}[0-9]{4}"> <inputtype="color"> <inputtype="submit"value="Search"> </form>
  • 30. Pixel is not a pixel 1 CSS Px= 1 Device Px CSS pixel –reference pixels, which are the main measure points for browsers measurements. Device pixel –physical pixels, which are the main measure points for device graphics actions. Zoom out Zoom in 1 CSS Px= 4 Device Px, Retina=)
  • 31. Prepare for responsive -componentsfunction priority -target devicesscreens -target audience and it’s context
  • 32. Refs •Responsive Web Design, Ethan Marcotte •Mobile First, Luke Wroblewski •http://cssing.org.ua, YuriyArtyukh •http://dev.w3.org/csswg/css-device-adapt/#the-atviewport-rule •https://developer.apple.com/library/safari/documentation/AppleApplications/Reference/SafariHTMLRef/Articles/MetaTags.html •https://github.com/scottjehl/picturefill •http://adaptive-images.com •http://www.quirksmode.org/mobile/viewports2.html •http://www.quirksmode.org/blog/archives/2010/04/a_pixel_is_not.html •http://www.w3.org/TR/wai-aria/ •http://designinstruct.com/roundups/html5-frameworks/ •http://mashable.com/2013/04/26/css-boilerplates-frameworks/ •http://www.ted.com/talks/simon_sinek_how_great_leaders_inspire_action.html