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
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
270
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
210
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
ふつうのFeature Flag実践入門
irof
7
3.5k
net-httpのHTTP/2対応について
naruse
0
430
プロパティの順序で型推論が壊れる!? TypeScript6.0の修正からContext-Sensitivityの仕組みを追う
bicstone
2
1.3k
TypeScript+Orvalで実現する型安全かつ堅牢でスケーラブルなマルチチャネル通知基盤 / TSKaigi Night talks ~after conference~
d0riven
0
250
TSKaigi Night Talks 2026_TypeScriptでサプライチェーンの整合性を型に閉じ込める
geekplus_tech
0
250
運用エージェントは "作る" から "育てる" へ - 記憶と自己進化の3層設計パターン / self-evolving-agents-three-layer-agent-design
gawa
12
3.4k
脅威をエンジニアリングの糧にして――現場編 / Turning Threats into Engineering Fuel — Field Edition
nrslib
0
250
AutonomyとControlのあいだ:Graflowで記述するAIエージェント協調
myui
0
100
DynamoDBには集計系のクエリがないけどなんとかしたい
musan
1
130
AI駆動開発で崩れていくコードベースを立て直す
kyoko_nr_nr
1
430
Spec-Driven Development with AI-Agents: From High-Level Requirements to Working Software
antonarhipov
2
440
LLM Plugin for Node-REDの利用方法と開発について
404background
0
160
Featured
See All Featured
Build your cross-platform service in a week with App Engine
jlugia
234
18k
Facilitating Awesome Meetings
lara
57
6.9k
Statistics for Hackers
jakevdp
799
230k
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
770
Become a Pro
speakerdeck
PRO
31
6k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.8k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
220
Agile that works and the tools we love
rasmusluckow
331
21k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
200
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
130
Paper Plane (Part 1)
katiecoart
PRO
0
8.4k
The browser strikes back
jonoalderson
0
1.1k
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!