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
Building websites for HiDPI devices
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Vinay M
March 23, 2013
Technology
5.2k
5
Share
Building websites for HiDPI devices
Presented at front end meetup Singapore
Vinay M
March 23, 2013
More Decks by Vinay M
See All by Vinay M
DRY css with Sass
artminister
1
150
CSS Best Practices
artminister
6
290
Other Decks in Technology
See All in Technology
AI와 협업하는 조직으로의 여정
arawn
0
420
20年前の「OSS革命」に学ぶ AI時代の生存戦略
samakada
0
430
自立を加速させる神器 - EMOasis #11
stanby_inc
0
140
LLM時代の検索アーキテクチャと技術的意思決定
shibuiwilliam
3
1.2k
AzureのIaC管理からログ調査まで、随所に役立つSkillsとCustom-Instructions / Boosting IaC and Log Analysis with Skills
aeonpeople
0
230
EBS暗号化に失敗してEC2が動かなくなった話
hamaguchimmm
2
200
AWS DevOps Agentはチームメイトになれるのか?/ Can AWS DevOps Agent become a teammate
kinunori
6
740
ワールドカフェI /チューターを改良する / World Café I and Improving the Tutors
ks91
PRO
0
320
Eight Engineering Unit 紹介資料
sansan33
PRO
3
7.3k
基盤を育てる 外部SaaS連携の運用
gamonges_dresscode
1
120
Rebirth of Software Craftsmanship in the AI Era
lemiorhan
PRO
4
2k
明日からドヤれる!超マニアックなAWSセキュリティTips10連発 / 10 Ultra-Niche AWS Security Tips
yuj1osm
0
590
Featured
See All Featured
Building Adaptive Systems
keathley
44
3k
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.5k
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
160
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
69
39k
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
720
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
170
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
1
520
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
3.8k
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
260
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.4k
Navigating Weather and Climate Data
rabernat
0
170
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
180
Transcript
BUILDING WEBSITES FOR RETINA (HiDPI) DEVICES Vinay M www.artminister.com
The web’s primary design principle is universality... it should be
accessible from any kind of hardware that can connect to the Internet: stationary or mobile, small screen or large. — Tim Berners-Lee
Pixel Density (PPI) of Devices Windows: ~96 DPI Mac: ~72
- 120 DPI Retina MBP: 220 DPI
Pixel Density (PPI) of Devices Chromebook Pixel : 239 PPI
HTC Jbutterfly Pixel Ratio: 3 PPI: 440 Samsung SIV Pixel
Ratio: 2 PPI: 441 iPhone 5 Pixel Ratio: 2 PPI: 326 Mobile Devices
PPI (Pixels per inch) 320+ PPI 240 PPI 160 PPI
120 PPI Extra HiDPI Baseline for mobile devices
CSS Pixels 568 x 320 Device Pixels @2X iPhone5: 1136
x 640
Non-Retina HiDPI
High DPI • Greater pixel density • Physical Resolution is
higher (2x) • Content Resolution is constant • Content Scale is higher (2x)
Device Independent Pixels • = CSS Pixels • CSS Pixels
= Device Pixels/device-pixel-ratio
What’s the problem IMAGES Images are not sharp on HiDPI
devices
How do we target devices • CSS • Javascript •
Built-in browser features • Server side delivery of images
CSS: device-pixel-ratio USE IT NOW
CSS: device-pixel-ratio • Pros – Downloads the right image based
on pixel-ratio • Cons – No support for <img > – High DPI device will download large image on Low Bandwidth connection – Multiple Image versions
CSS: IMAGE-SET • Only Supports Background Images • Chrome and
Safari support ONLY CHROME & SAFARI, POLYFILL
Browser features • Srcset • Polyfill: https://github.com/borismus/srcset-polyfill/ No browser support
yet. But its in the specs. http://www.w3.org/html/wg/drafts/srcset/w3c-srcset/ POLYFILL
<picture> • Still in the W3C first working draft •
Polyfill: https://github.com/scottjehl/picturefill Source: http://responsiveimages.org POLYFILL
Other Image Tweeks • Background-size: • Compress 2x images –
Webp: https://developers.google.com/speed/webp/
Javacript • Window.devicePixelRatio
window.matchMedia • Media Queries in JS https://hacks.mozilla.org/2012/06/using-window-matchmedia-to-do-media- queries-in-javascript/ SAFARI, CHROME,
FIREFOX MOBILE
Server Side • CMS (Wordpress) • http://www.resrc.it : – Delivers
the right image based on the screen size – Bandwidth Detection
What if everyone has a HiDPI screen • Ultra High
Definition (UHD) – 4k TVs – 8K - 7680×4320 Resolution • vw & vh units – 1 vw = 1/100 of viewport width • 2X the images everywhere ?
Physical Units ? • Very hard to distinguish between devices
– iPad 2 and iPad Mini – Phone to 7’’ tablets – 7’’ tablet to 10’’ tablet • Elements across devices are not of the same physical size – Use <button style=“width: 2inch;”> ? • Safari/Chrome does not support @media screen and (min-resolution :320dpi)
To Consider for HiDPI • Eliminate Images + Use CSS3
• Web fonts for icons • SVG • Use image-set and srcset • Use Viewport units – vw, vh
Thank You • Slides: https://speakerdeck.com/artminister • Many thanks to –
Micheal Cheng (@coderkungfu) – Hackerspace SG • Calling for speakers
Other User groups and Resources • Talk.js http://www.meetup.com/Singapore-JS/events/99986652/ • Singapore
JS https://www.facebook.com/groups/488579174512027/ • HTML5 Rocks SG http://www.meetup.com/HTML5Rocks-SG/ • Webuild – http://webuild.sg