Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
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
250
User First
pazguille
1
200
#OfflineFirst
pazguille
3
5.9k
ES6 in Production
pazguille
10
3.2k
No me hagas esperar!
pazguille
1
170
Hello, Style Guides!
pazguille
0
270
Decoupling your JavaScript
pazguille
0
180
Progressive Enhancement - Is it still important?
pazguille
0
120
Other Decks in Programming
See All in Programming
dotfiles 式年遷宮 令和最新版
masawada
1
790
大規模Cloud Native環境におけるFalcoの運用
owlinux1000
0
130
TerraformとStrands AgentsでAmazon Bedrock AgentCoreのSSO認証付きエージェントを量産しよう!
neruneruo
3
550
Tinkerbellから学ぶ、Podで DHCPをリッスンする手法
tomokon
0
140
エディターってAIで操作できるんだぜ
kis9a
0
740
Microservices rules: What good looks like
cer
PRO
0
1.5k
tsgolintはいかにしてtypescript-goの非公開APIを呼び出しているのか
syumai
7
2.3k
生成AIを利用するだけでなく、投資できる組織へ
pospome
2
370
Canon EOS R50 V と R5 Mark II 購入でみえてきた最近のデジイチ VR180 事情、そして VR180 静止画に活路を見出すまで
karad
0
130
WebRTC、 綺麗に見るか滑らかに見るか
sublimer
1
190
認証・認可の基本を学ぼう後編
kouyuume
0
240
実は歴史的なアップデートだと思う AWS Interconnect - multicloud
maroon1st
0
220
Featured
See All Featured
How GitHub (no longer) Works
holman
316
140k
sira's awesome portfolio website redesign presentation
elsirapls
0
87
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
22
Everyday Curiosity
cassininazir
0
100
How to make the Groovebox
asonas
2
1.8k
Fireside Chat
paigeccino
41
3.7k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
51k
jQuery: Nuts, Bolts and Bling
dougneiner
65
8.3k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3k
HDC tutorial
michielstock
0
260
A designer walks into a library…
pauljervisheath
210
24k
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
87
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!