$30 off During Our Annual Pro Sale. View Details »
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Web Cross Device
Search
Jacopo Rabolini
May 23, 2015
Programming
0
55
Web Cross Device
Presentazione relativa al workshop tenuto alla Wired Next Fest 2015.
Jacopo Rabolini
May 23, 2015
Tweet
Share
More Decks by Jacopo Rabolini
See All by Jacopo Rabolini
A Community of Communities
kingfelix
0
34
Other Decks in Programming
See All in Programming
251126 TestState APIってなんだっけ?Step Functionsテストどう変わる?
east_takumi
0
310
WebRTC と Rust と8K 60fps
tnoho
2
1.9k
Full-Cycle Reactivity in Angular: SignalStore mit Signal Forms und Resources
manfredsteyer
PRO
0
120
AIの誤りが許されない業務システムにおいて“信頼されるAI” を目指す / building-trusted-ai-systems
yuya4
6
2.4k
手軽に積ん読を増やすには?/読みたい本と付き合うには?
o0h
PRO
1
170
関数実行の裏側では何が起きているのか?
minop1205
1
680
Rediscover the Console - SymfonyCon Amsterdam 2025
chalasr
2
160
JETLS.jl ─ A New Language Server for Julia
abap34
1
310
開発に寄りそう自動テストの実現
goyoki
1
770
從冷知識到漏洞,你不懂的 Web,駭客懂 - Huli @ WebConf Taiwan 2025
aszx87410
1
1.3k
Navigation 3: 적응형 UI를 위한 앱 탐색
fornewid
1
220
Cell-Based Architecture
larchanjo
0
110
Featured
See All Featured
Statistics for Hackers
jakevdp
799
230k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.3k
Writing Fast Ruby
sferik
630
62k
4 Signs Your Business is Dying
shpigford
186
22k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
2.7k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
48
9.8k
A Modern Web Designer's Workflow
chriscoyier
698
190k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
10
720
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
1.8k
Bootstrapping a Software Product
garrettdimon
PRO
307
120k
Principles of Awesome APIs and How to Build Them.
keavy
127
17k
Transcript
Web Cross Device GDG Milano @ Wired Next Fest 2015
gdgmilano.org / jacoporabolini.com
“Il web è progettato per essere universale: per includere tutto
e tutti.” - Tim Berners-Lee
C’era una volta... image: http://bradfrost.com/blog/web/responsive-web-design-missing-the-point/
... sì, una volta appunto! image: http://bradfrost.com/blog/web/responsive-web-design-missing-the-point/
desktop vs mobile Marzo 2015 Desktop Mobile 10.6% 11.3 http://www.comscore.com/ita/Insights/Blog/Number-of-Mobile-Only-Internet-Users-Now-Exceeds-
Desktop-Only-in-the-U.S
Meglio prepararsi! image: http://bradfrost.com/blog/web/responsive-web-design-missing-the-point/
Di cosa parleremo 1) Layout Fluid 2) La viewport 3)
Le media query 4) Codelab
4 approcci differenti Fixed unità di misura assolute Fluid unità
di misura relative Adaptive layout specifici per device Responsive Fluid + Adaptive
Layout Fluid
px, pt ems, % Da Fixed a Fluid
Magikabula! target ÷ context il valore desiderato in pixel la
dimensione del contenitore in pixel
Da Fixed a Fluid: text <h2> Questo è un titolo
<a href=”#”>e questo un link</a> </h2> HTML
h2 { font-size: 24px; } h2 a { font-size: 18px;
} h2 { font-size: 1.5em; } /* 24px ÷ 16px */ h2 a { font-size: 0.75em; } /* 18px ÷ 24px */ CSS CSS Da Fixed a Fluid: text
<div class=”wrap”> <div class=”content”>...</div> <div class=”sidebar”>...</div> </div> HTML Da Fixed
a Fluid: width & margin
ok ma il context? Per width e margin il context
è sempre relativo all’elemento contenitore.
.wrap { width: 1024px; } .content { width: 684px; margin-right:
20px; } .wrap { width: 90%; } /* convertito in % */ .content { width: 66.8%; margin-right: 20px; } CSS CSS Da Fixed a Fluid: width & margin
.wrap { width: 1024px; } .content { width: 684px; margin-right:
20px; } .wrap { width: 90%; } .content { width: 66.8%; margin-right: 1.95%; } Da Fixed a Fluid: width & margin CSS CSS
.wrap { width: 1024px; } .sidebar { width: 320px; }
.wrap { width: 90%; } .sidebar { width: 31.25%; } CSS CSS Da Fixed a Fluid: width & margin
<div class=”content”> <p class=”box”>...</p> <p class=”box”>...</p> </div> HTML Da Fixed
a Fluid: padding
Attenzione al context! Per il padding il context è sempre
relativo all’elemento stesso.
.content { width: 684px; margin-right: 20px; } .box { width:
332px; padding: 10px; } CSS .content { width: 66.8%; margin-right: 1.95%; } .box { width: 48.54%; padding: 3.01%; } CSS Da Fixed a Fluid: padding
La viewport
La nostra area visibile viewport viewport
Pixel is not a pixel is not a pixel 1)
Pixel hardware 2) Pixel indipendenti dal dispositivo (dip) 3) Pixel CSS
ok, quali usiamo? ➔ Device pixel ratio (dpr): rapporto tra
pixel hardware e dip ➔ Initial-scale: rapporto tra dip e pixel CSS
Un po’ d’ordine, grazie! <meta name=”viewport” content=”width=device-width, initial-scale=1” > HTML
Ora si ragiona! pixel hardware = dip = pixel CSS
Le media query
Le @media rules... @media screen { /* regole per screen
*/ } CSS <link rel=”stylesheet” type=”text/css” media=”handheld” href=”handheld.css” /> HTML
...e le @media query @media screen and (min-width: 760px) {
/* regole per schermi di almeno 760px */ } CSS medium aggiungiamo condizioni la media feture
media features • width • height • min-width • min-height
• max-width • max-height • orientation • ... valore landscape o portrait
@media query, un esempio @media screen and (min-width: 320px) {
.wrap { background-color: #AA3939; } } @media screen and (min-width: 760px) { .wrap { background-color: #183F98; } } CSS
ed ecco il risultato 760px 320px
@media query, altro esempio @media screen and (min-width: 320px) {
.sidebar, .content { float: none; } } @media screen and (min-width: 760px) { .sidebar { float: left; } .content { float: right; } } CSS
layout diversi!
Tutto assieme e... Il layout fluido collega le diverse visualizzazioni
di un sito, tra un breakpoint e il successivo.
...responsive! fluid breakpoint
Cosa abbiamo visto: • Il web è universale • 4
approcci: fixed, fluid, adaptive e responsive • Target ÷ Context nei layout fluid • La viewport e i pixel • Le media query • Tutto assieme!
Domande?
Codelab :)
Gli obiettivi: 1) Esaminare il codice del sito demo 2)
Impostare il testo in unità relative (em) 3) Impostare width, margin e padding in unità relative (%) 4) Resettare la viewport 5) Identificare i breakpoint 6) Modificare il layout in corrispondenza dei breakpoint
Risorse: gdgmilano.org/wired
Restiamo in contatto! ★ Jacopo Rabolini | Web & Graphic
designer ➔ jacoporabolini.com ➔
[email protected]
➔ google.com/+jacoporabolini
Grazie!