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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
ThorVG Viewer In VS Code
nors
0
760
コマンドとリード間の連携に対する脅威分析フレームワーク
pandayumi
1
450
Spinner 軸ズレ現象を調べたらレンダリング深淵に飲まれた #レバテックMeetup
bengo4com
1
230
インターン生でもAuth0で認証基盤刷新が出来るのか
taku271
0
190
AIで開発はどれくらい加速したのか?AIエージェントによるコード生成を、現場の評価と研究開発の評価の両面からdeep diveしてみる
daisuketakeda
1
970
Smart Handoff/Pickup ガイド - Claude Code セッション管理
yukiigarashi
0
130
カスタマーサクセス業務を変革したヘルススコアの実現と学び
_hummer0724
0
640
OCaml 5でモダンな並列プログラミングを Enjoyしよう!
haochenx
0
140
Honoを使ったリモートMCPサーバでAIツールとの連携を加速させる!
tosuri13
1
170
CSC307 Lecture 07
javiergs
PRO
0
550
AI & Enginnering
codelynx
0
110
責任感のあるCloudWatchアラームを設計しよう
akihisaikeda
3
160
Featured
See All Featured
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
2.1k
ラッコキーワード サービス紹介資料
rakko
1
2.2M
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
130
The Curious Case for Waylosing
cassininazir
0
230
WCS-LA-2024
lcolladotor
0
450
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
0
250
Odyssey Design
rkendrick25
PRO
1
490
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
7.9k
The Power of CSS Pseudo Elements
geoffreycrofte
80
6.1k
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
62
49k
Claude Code のすすめ
schroneko
67
210k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
0
3.4k
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!