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
390
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
210
No me robes el Scroll!
pazguille
0
190
User First
pazguille
1
170
#OfflineFirst
pazguille
3
5.8k
ES6 in Production
pazguille
10
2.9k
No me hagas esperar!
pazguille
1
120
Hello, Style Guides!
pazguille
0
210
Decoupling your JavaScript
pazguille
0
140
Progressive Enhancement - Is it still important?
pazguille
0
91
Other Decks in Programming
See All in Programming
ドメインイベント増えすぎ問題
h0r15h0
1
120
ゆるやかにgolangci-lintのルールを強くする / Kyoto.go #56
utgwkk
1
360
talk-with-local-llm-with-web-streams-api
kbaba1001
0
170
数十万行のプロジェクトを Scala 2から3に完全移行した
xuwei_k
0
260
アクターシステムに頼らずEvent Sourcingする方法について
j5ik2o
4
180
Асинхронность неизбежна: как мы проектировали сервис уведомлений
lamodatech
0
660
【re:Growth 2024】 Aurora DSQL をちゃんと話します!
maroon1st
0
770
Haze - Real time background blurring
chrisbanes
1
510
これでLambdaが不要に?!Step FunctionsのJSONata対応について
iwatatomoya
2
3.6k
42 best practices for Symfony, a decade later
tucksaun
1
180
Criando Commits Incríveis no Git
marcelgsantos
2
170
Webエンジニア主体のモバイルチームの 生産性を高く保つためにやったこと
igreenwood
0
330
Featured
See All Featured
Automating Front-end Workflow
addyosmani
1366
200k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
RailsConf 2023
tenderlove
29
940
Facilitating Awesome Meetings
lara
50
6.1k
Intergalactic Javascript Robots from Outer Space
tanoku
270
27k
Scaling GitHub
holman
458
140k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
2
170
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
Making Projects Easy
brettharned
116
5.9k
Thoughts on Productivity
jonyablonski
67
4.4k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
26
1.9k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
45
2.2k
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!