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
51
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
26
Other Decks in Programming
See All in Programming
PostmanでAPIの動作確認が楽になった話
h455h1
0
160
try! Swift Tokyo 2024のLT枠に採択されたプロポーザルを出すときに考えていたこと
ski
0
350
MetricKitで予期せぬ終了を検知する話 / Detect unexpected termination with MetricKit
nekowen
0
180
PHP8.3の機能を振り返る / Review of PHP 8.3 features
seike460
PRO
1
110
From Spring Boot 2 to Spring Boot 3 with Java 22 and Jakarta EE
ivargrimstad
0
1.1k
Elm 0.19.0 Changes
bkuhlmann
0
490
Folding Cheat Sheet #3
philipschwarz
PRO
0
120
Goのmultiple errorsについて (2024年4月版)
syumai
1
430
二郎系ラーメンのコールで学ぶ AST 解析
memory1994
PRO
7
1.7k
DMMプラットフォームがTiDB Cloudを採用した背景
pospome
8
4k
Ruby Pattern Matching
bkuhlmann
0
920
Build Apps for iOS, Android & Desktop in 100% Kotlin With Compose Multiplatform (mDevCamp 2024)
zsmb
0
240
Featured
See All Featured
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
221
21k
How to train your dragon (web standard)
notwaldorf
73
5.2k
Atom: Resistance is Futile
akmur
259
25k
GraphQLとの向き合い方2022年版
quramy
32
12k
Build The Right Thing And Hit Your Dates
maggiecrowley
24
2k
Facilitating Awesome Meetings
lara
42
5.6k
Building Applications with DynamoDB
mza
88
5.6k
Code Reviewing Like a Champion
maltzj
514
39k
The MySQL Ecosystem @ GitHub 2015
samlambert
243
12k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
659
120k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
244
20k
The Language of Interfaces
destraynor
151
23k
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!