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
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
240
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
Findy AI+の開発、運用におけるMCP活用事例
starfish719
0
2.2k
Basic Architectures
denyspoltorak
0
270
Denoのセキュリティに関する仕組みの紹介 (toranoana.deno #23)
uki00a
0
230
クラウドに依存しないS3を使った開発術
simesaba80
0
230
Grafana:建立系統全知視角的捷徑
blueswen
0
290
SQL Server 2025 LT
odashinsuke
0
160
副作用をどこに置くか問題:オブジェクト指向で整理する設計判断ツリー
koxya
1
450
Unicodeどうしてる? PHPから見たUnicode対応と他言語での対応についてのお伺い
youkidearitai
PRO
0
580
例外処理とどう使い分ける?Result型を使ったエラー設計 #burikaigi
kajitack
16
5.5k
メルカリのリーダビリティチームが取り組む、AI時代のスケーラブルな品質文化
cloverrose
2
470
Giselleで作るAI QAアシスタント 〜 Pull Requestレビューに継続的QAを
codenote
0
340
AI前提で考えるiOSアプリのモダナイズ設計
yuukiw00w
0
210
Featured
See All Featured
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.3k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.1k
The Cult of Friendly URLs
andyhume
79
6.8k
Reality Check: Gamification 10 Years Later
codingconduct
0
2k
Speed Design
sergeychernyshev
33
1.5k
A Modern Web Designer's Workflow
chriscoyier
698
190k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.6k
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
1.8k
Code Reviewing Like a Champion
maltzj
527
40k
Designing for Timeless Needs
cassininazir
0
120
From π to Pie charts
rasagy
0
120
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!