際際滷

際際滷Share a Scribd company logo
What is responsive?
And do I need it?
Carsten Sandtner  IPC 2015  @casarock
Carsten
Sandtner
Head of Development
@mediaman GmbH
Web Developer since 1998
@casarock
History!
https://鍖ic.kr/p/9iMKjU
First responsive
Webpage!
The 鍖rst website!
Print Design!
https://鍖ic.kr/p/8xbEBF
Design for one resolution
Bring print to the web (1:1)
Pixelperfect
What is responsive - and do I need it?
dummy.gif
Floating boxes
https://鍖ic.kr/p/4MFRpB
Finally a solution?
depends
=>
https://css-tricks.com/all-about-floats/
1994
Media Queries
H奪konWiumLie
1997
Media Queries: HTML4
considers to include them
2001
Media Queries:
Working draft
mobile
revolution
2008
2010
Responsive Web Design
EricMarcotte//Photoby:MartinKraft[CCBY-SA3.0]
http://alistapart.com/article/responsive-web-design
Combination of:
media queries
鍖exible widths
鍖exible images
RWD
2010
2012
Media Queries: W3C
Recommendation
Flexbox
https://鍖ic.kr/p/nnnhq3
The CSS3 Flexible Box, or flexbox, is a
layout mode providing for the
arrangement of elements on a page
such that the elements behave
predictably when the page layout must
accommodate different screen sizes
and different display devices.
MDN: https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Flexible_boxes
display: box;
~2009
Flexbox (鍖rst version)
display: flexbox;
~2011
Flexbox (second version)
display: flex;
> 2011
Flexbox (壊沿艶界庄鍖c温岳庄看稼!)
RWD - in a nutshell
https://鍖ic.kr/p/bYxKaN
Liquid:
鍖uid layout
Adaptive:
pre-de鍖ned layout widths
media queries
Definitions
liquid vs. adaptive
Definitions
responsive
http://blog.froont.com/9-basic-principles-of-responsive-web-design/
Combination
Optimal rendering across 糸艶厩庄界艶壊G看温鉛
鞄岳岳沿壊://鍖i界.一姻/沿/温稼晦界堰顎
https://www.youtube.com/watch?v=SpRBvtm_wrQ
What could possibly go
wrong?
Image Sizes
too Big
Megabytes of data!
Even for mobile.
Images look a little fuzzy in high
resolutions.
Image Sizes
too small
Solution?
<img src=/slideshow/what-is-responsive-and-do-i-need-it/49127120/"fallback.jpg"
srcset="small.jpg 640w 1x,
small-hd.jpg 640w 2x,
large.jpg 1x,
large-hd.jpg 2x"
alt="">
HTML/CSS
srcset
<picture alt="description">
<source src=/slideshow/what-is-responsive-and-do-i-need-it/49127120/"small.jpg">
<source src="medium.jpg"
media="(min-width: 40em)">
<source src="large.jpg"
media="(min-width: 80em)">
</picture>
HTML/CSS
picture
皆顎沿沿看姻岳
Browser Support
srcset vs. picture
http://caniuse.com
Meanwhile
https://鍖ic.kr/p/fqofd6
Deliver same Content
Why?!
Content
Mobile users want compact content
Why should I deliver hidden
content then?
Content
same same but different
Rearrange Content on different
View Ports?
Content
structure
.some-element {
display: flex;
flex-direction: row;
order: 1;
}
Flexbox FTW!
Browser Support
鍖exbox
http://caniuse.com
Why load and parse unused
Javascripts and CSS?
Content
Javascripts/CSS
<!DOCTYPE HTML>
<html lang="en-US">
<head>

<link rel=stylesheet" media=screen
and (min-width: 600px)"
href=small.css">
<link rel=stylesheet" media=screen
and (min-width: 2048px)
href=biggest.css">

</head>
<body>

</body>
</html>
Conditional loading?
CSS
What is responsive - and do I need it?
Back to 
https://鍖ic.kr/p/fqofd6
Dont even think about parallax
Dont even think about parallax on
mobile!
Effects
Javascript
https://鍖ic.kr/p/cvvPLq
<script>
if (document.documentElement.clientWidth > 640) {
document.write('<script src=/slideshow/what-is-responsive-and-do-i-need-it/49127120/"/ads.com/banner.js"></script>');
document.write('<script src="livechat.js"></script>');
}
</script>
Conditional loading?
<script data-mq="(min-width: 640px)"
data-src=/slideshow/what-is-responsive-and-do-i-need-it/49127120/"/ads.com/banner.js"></script>
<script data-mq="(min-width: 640px)"
data-src="livechat.js" ></script>
<script>
var scripts = document.getElementsByTagName("script");
for(var i=0;i<scripts.length; i++) {
// Test if the Media Query matches
var mq = scripts[i].getAttribute("data-mq");
if (mq && window.matchMedia(mq).matches) {
// If so, append the new (async) element.
var s = document.createElement("script");
s.type = 'text/javascript';
s.src = scripts[i].getAttribute("data-src");
document.body.appendChild(s);
}
}
</script>
Better
Conditional loading?
https://www.safaribooksonline.com/library/view/responsive-fast/9781491912935/ch04.html
Desktop vs. mobile
https://鍖ic.kr/p/bmJtgf
Mobile first?
Use Case!
Consider
Same content across devices?
Page with a lot of visuals?
Target group?
Target screen size?
Content rich sites
m.domains?
Pro
lightweight
mobile optimized
Con
SEO
One URL per Page
redirects
m.domain
Should I.
Client site feature
detection
https://鍖ic.kr/p/ac3oaX
Feature detection
Conditional loading helpers
Modernizr
features
<script>
if (Modernizr.webgl){
doFancyStuff();
} else {
doSlowFancyStuff();
}
</script>
Feature
detection
<script>
Modernizr.load({
test: Modernizr.geolocation,
yep : ['geo.js', 'superfancy.css']
nope: 'geo-polyfill.js'
});
</script>
Conditional
loading
It helps a lot, but you still detect
everything at your clients browser!
Modernizr
Swiss army knife?
RWD starts at your Server
https://鍖ic.kr/p/ac3oaX
Device-Description-Repository
Image optimization
Preprocessing HTML
Server
Viewport
Interaction model (touch?)
Hardware (Sensors)
Device-Description-
Repository
more than screen sizes
Some Images are
scaleable
some not
Dont load more than youre going to show!
Image optimization
Why?
optimized HTML across Screens
Less logic, less Javascript!
Hidden content not necessary
Preprocessing HTML
Serversite rendering
https://鍖ic.kr/p/ac3oaX
reloaded!
Pro
less bloated HTML
only needed scripts will get loaded
Contra
higher server load
device detection is not reliable!
Server-Site Rendering
Best of both
https://鍖ic.kr/p/69ZiLn
Responsive Design +
Server Side Components
1. Get a DDR
2. Write Server-Side Code using
DDR (e.g. conditional loading
etc.)
3. Enhance rendered HTML on
Client-Side
RESS
In a nutshell
1. Get a DDR
2. Detect features on Client-
Side
3. Write Server-Side Code using
DDR (e.g. conditional loading
etc.)
4. Set Cookies, reload.
RESS
In a nutshell
Websites should be loaded FAST
Websites should have a nice UX
Content should be optimized!
Content should be meaningful!
Why such a hassle?
Conclusion
https://鍖ic.kr/p/7Cv2gu
Know your use case
Involve your server
RWD is NOT the holy grail!
sometimes a mobile site makes sense
Dont forget the user!
Conclusion
Links
https://bradfrost.github.io/this-is-responsive/
http://www.liquidapsive.com/
http://alistapart.com/article/responsive-web-design
https://www.youtube.com/watch?v=XhCXINNvmv8
http://modernizr.com/
Questions?
https://鍖ic.kr/p/qTw4b4
Contact me:
@casarock
hallo@appsbu.de

More Related Content

What is responsive - and do I need it?