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
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Guille Paz
January 10, 2014
Programming
0
440
CSS Sprites vs. Data URIs
Are Data URIs better than CSS Sprites?
@pazguille & @taly
Guille Paz
January 10, 2014
Tweet
Share
More Decks by Guille Paz
See All by Guille Paz
The Road to Node
pazguille
0
250
No me robes el Scroll!
pazguille
0
260
User First
pazguille
1
210
#OfflineFirst
pazguille
3
5.9k
ES6 in Production
pazguille
10
3.2k
No me hagas esperar!
pazguille
1
180
Hello, Style Guides!
pazguille
0
270
Decoupling your JavaScript
pazguille
0
180
Progressive Enhancement - Is it still important?
pazguille
0
130
Other Decks in Programming
See All in Programming
生成AIを使ったコードレビューで定性的に品質カバー
chiilog
1
260
AI Schema Enrichment for your Oracle AI Database
thatjeffsmith
0
270
AI前提で考えるiOSアプリのモダナイズ設計
yuukiw00w
0
230
MDN Web Docs に日本語翻訳でコントリビュート
ohmori_yusuke
0
650
React 19でつくる「気持ちいいUI」- 楽観的UIのすすめ
himorishige
11
7.4k
AI巻き込み型コードレビューのススメ
nealle
1
170
CSC307 Lecture 08
javiergs
PRO
0
670
Rust 製のコードエディタ “Zed” を使ってみた
nearme_tech
PRO
0
170
例外処理とどう使い分ける?Result型を使ったエラー設計 #burikaigi
kajitack
16
6k
CSC307 Lecture 05
javiergs
PRO
0
500
Grafana:建立系統全知視角的捷徑
blueswen
0
330
SourceGeneratorのススメ
htkym
0
190
Featured
See All Featured
Utilizing Notion as your number one productivity tool
mfonobong
3
220
AI Search: Where Are We & What Can We Do About It?
aleyda
0
6.9k
Abbi's Birthday
coloredviolet
1
4.7k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
Ruling the World: When Life Gets Gamed
codingconduct
0
140
How To Stay Up To Date on Web Technology
chriscoyier
791
250k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
2
940
Done Done
chrislema
186
16k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3k
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
130
The browser strikes back
jonoalderson
0
370
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
90
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!