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
CSS Sprites vs. Data URIs
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Guille Paz
January 10, 2014
Programming
460
0
Share
CSS Sprites vs. Data URIs
Are Data URIs better than CSS Sprites?
@pazguille & @taly
Guille Paz
January 10, 2014
More Decks by Guille Paz
See All by Guille Paz
The Road to Node
pazguille
0
260
No me robes el Scroll!
pazguille
0
280
User First
pazguille
1
220
#OfflineFirst
pazguille
3
6k
ES6 in Production
pazguille
10
3.2k
No me hagas esperar!
pazguille
1
200
Hello, Style Guides!
pazguille
0
280
Decoupling your JavaScript
pazguille
0
190
Progressive Enhancement - Is it still important?
pazguille
0
150
Other Decks in Programming
See All in Programming
気づいたらRubyで100作品 ー クリエイティブコーディングが生活の一部になるまで / 100 Ruby Sketches Later: How Creative Coding Became Part of My Life
chobishiba
3
500
Hive Metastoreを通して学ぶIceberg REST Catalog ― 仕様から実装まで
okumin
0
310
タクシーアプリ『GO』の バックエンド開発のおける AI利活用と若者のすべて
pyama86
3
1.8k
GitHub Copilot CLIのいいところ
htkym
2
1.2k
肥大化するレガシーコードに立ち向かうためのインターフェース分離と依存の逆転 / JJUG CCC 2026 Spring
hirokunimaeta
0
270
Oxlintのカスタムルールの現況
syumai
5
910
inferと仲良くなる10分間
ryokatsuse
1
280
TSKaigi2026-静的解析への投資がAI時代のコード品質を支える ── カスタムESLintルールの設計と運用
hayatokudou
7
1.3k
[KCD Czech] eBPF Meets the GPU: Future of AI Infra Observability
doniacld
0
130
技術記事、AIに書かせるか、自分で書くか? 〜それでも私が自分の手で書く理由〜 / #QiitaConference
jnchito
2
1.2k
サーバーレスで作る、動画データ管理基盤
oyasumipants
0
320
密結合なバックエンドから TypeScript のコードを生成する
kemuridama
1
390
Featured
See All Featured
Test your architecture with Archunit
thirion
1
2.3k
Statistics for Hackers
jakevdp
799
230k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
380
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
200
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
Building Flexible Design Systems
yeseniaperezcruz
330
40k
How GitHub (no longer) Works
holman
316
150k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
590
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.2k
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.5k
From π to Pie charts
rasagy
0
190
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
190
Transcript
Data URI The myths
Base64
http://tools.ietf.org/html/rfc3548 Encoding data (files) in plain text
Data URIs Uniform Resource Identifier
A way to include data in a web page
Syntax
<img src=“data:image/png;base64,IVBOR...”>
<img src=“data:image/png;base64,IVBOR...”> • data - name of the scheme
<img src=“data:image/png;base64,IVBOR...”> • data - name of the scheme ◦
image/png - content type
<img src=“data:image/png;base64,IVBOR...”> • data - name of the scheme ◦
image/png - content type • base64 - type of encoding used to encode
<img src=“data:image/png;base64,IVBOR...”> • data - name of the scheme ◦
image/png - content type • base64 - type of encoding used to encode • IVBOR… - the encoded data
Why it rocks
Reduce the number of HTTP requests.
The ability to embed files inside of others files (CSS,
JS, images in-lined in the HTML)
Performance enhancement.
Sure?
None
None
Data URI http://www.webpagetest.org/result/131227_FM_JD4/1/details/
Data URI http://www.webpagetest.org/result/131227_FM_JD4/1/details/
Data URI http://www.webpagetest.org/result/131227_FM_JD4/1/details/
Sprites http://www.webpagetest.org/result/131227_WR_JDT/1/details/
Sprites http://www.webpagetest.org/result/131227_WR_JDT/1/details/
Sprites http://www.webpagetest.org/result/131227_WR_JDT/1/details/
Sprites Data URI
It Sucks!
Increase the size of your HTML document or CSS file.
Sprites Data URI
Make the files themselves larger.
Are not separately cached from their containing document
IE8 limits data URIs to a maximum length of 32
KB.
It’s a pain to maintain
Bad User Experience: 100ms interactivity budget.
None
None
None
Recap
Are not always the best solution
Use on very small resources
Thank you!