Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
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
ゲームの物理 剛体編
fadis
0
340
AIコーディングエージェント(NotebookLM)
kondai24
0
190
안드로이드 9년차 개발자, 프론트엔드 주니어로 커리어 리셋하기
maryang
1
110
WebRTC、 綺麗に見るか滑らかに見るか
sublimer
1
160
Developing static sites with Ruby
okuramasafumi
0
290
テストやOSS開発に役立つSetup PHP Action
matsuo_atsushi
0
150
20 years of Symfony, what's next?
fabpot
2
360
【CA.ai #3】ワークフローから見直すAIエージェント — 必要な場面と“選ばない”判断
satoaoaka
0
240
Integrating WordPress and Symfony
alexandresalome
0
150
著者と進める!『AIと個人開発したくなったらまずCursorで要件定義だ!』
yasunacoffee
0
130
React Native New Architecture 移行実践報告
taminif
1
150
AIコーディングエージェント(Gemini)
kondai24
0
220
Featured
See All Featured
How To Stay Up To Date on Web Technology
chriscoyier
791
250k
The Invisible Side of Design
smashingmag
302
51k
Balancing Empowerment & Direction
lara
5
800
Java REST API Framework Comparison - PWX 2021
mraible
34
9k
We Have a Design System, Now What?
morganepeng
54
7.9k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
7.9k
The Cult of Friendly URLs
andyhume
79
6.7k
Bootstrapping a Software Product
garrettdimon
PRO
307
120k
For a Future-Friendly Web
brad_frost
180
10k
Testing 201, or: Great Expectations
jmmastey
46
7.8k
How to Think Like a Performance Engineer
csswizardry
28
2.4k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
710
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!