Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
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
54
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
33
Other Decks in Programming
See All in Programming
(Extension DC 2025) Actor境界を越える技術
teamhimeh
1
250
XP, Testing and ninja testing ZOZ5
m_seki
3
610
なぜGoのジェネリクスはこの形なのか? Featherweight Goが明かす設計の核心
ryotaros
7
1.1k
CSC305 Lecture 04
javiergs
PRO
0
260
株式会社 Sun terras カンパニーデック
sunterras
0
270
CSC509 Lecture 06
javiergs
PRO
0
260
複雑化したリポジトリをなんとかした話 pipenvからuvによるモノレポ構成への移行
satoshi256kbyte
1
1k
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
240
組込みだけじゃない!TinyGo で始める無料クラウド開発入門
otakakot
0
220
What's new in Spring Modulith?
olivergierke
1
140
Domain-centric? Why Hexagonal, Onion, and Clean Architecture Are Answers to the Wrong Question
olivergierke
2
810
その面倒な作業、「Dart」にやらせませんか? Flutter開発者のための業務効率化
yordgenome03
1
110
Featured
See All Featured
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
53k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
229
22k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.5k
Building Better People: How to give real-time feedback that sticks.
wjessup
368
20k
Unsuck your backbone
ammeep
671
58k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
7
900
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.4k
Large-scale JavaScript Application Architecture
addyosmani
514
110k
Optimizing for Happiness
mojombo
379
70k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Context Engineering - Making Every Token Count
addyosmani
5
220
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!