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
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
300
User First
pazguille
1
230
#OfflineFirst
pazguille
3
6k
ES6 in Production
pazguille
10
3.2k
No me hagas esperar!
pazguille
1
210
Hello, Style Guides!
pazguille
0
290
Decoupling your JavaScript
pazguille
0
200
Progressive Enhancement - Is it still important?
pazguille
0
170
Other Decks in Programming
See All in Programming
Webエンジニアなのにブラウザの仕組みがわからないので、Pythonで自作してみた
tatsuki12
4
1.5k
業務時間外もAIに働いてもらう話
colorful12
3
9.4k
[DroidKaigi 26] How We Moved from Android Studio to Slack
thisaay
0
110
仕様駆動開発の消費期限
watany
20
9.2k
Deep dive into the select statement (GopherCon UK)
jespino
0
160
プロポーザルを書いてもらう
pvcresin
0
590
楽しそうなつよつよエンジニアと目が死んでる僕/A brilliant engineer having a blast, and dead-eyed me.
3l4l5
2
270
ソフトウェアラスタライザ
fadis
1
750
MySQLとPostgreSQLって何が違うの?
akagami
0
150
AWS Transform Customによる Spring Boot 2.xから4.xへのVerUp
satoshi256kbyte
2
120
Claude Codeを組織的に動かして月400PRを実現した話
happy_ryo
0
160
レビュー履歴をAIに食わせて、 Compose移行を加速するs
shihochan
0
250
Featured
See All Featured
Agile that works and the tools we love
rasmusluckow
331
22k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.8k
Design in an AI World
tapps
1
290
Information Architects: The Missing Link in Design Systems
soysaucechin
1
1.1k
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
180
Documentation Writing (for coders)
carmenintech
77
5.5k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.5k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
7.9k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
220
What's in a price? How to price your products and services
michaelherold
247
13k
Reality Check: Gamification 10 Years Later
codingconduct
0
2.3k
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!