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
290
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
Creating Composable Callables in Contemporary C++
rollbear
0
150
代数的データ型って何が嬉しいの? #frontend_phpcon_do
kajitack
8
3.7k
Datadog × OpenTelemetry 入門と実践のあいだ
kn_to_maxpno
1
160
RTSPクライアントを自作してみた話
simotin13
0
610
依存関係から依存物へ―Dependencyという言葉の歴史をひも解く
j_lee
0
120
The NotImplementedError Problem in Ruby
koic
1
840
AI 時代のソフトウェア設計の学び方
masuda220
PRO
29
13k
フロントエンドとバックエンドで「1文字」を揃えよう
youkidearitai
PRO
0
710
AIとASP.NET Coreで雑Webアプリを作った話
mayuki
0
660
Spec Driven Development | AI Summit Lisbon
danielsogl
PRO
0
200
AI 輔助遺留系統現代化的經驗分享
jame2408
1
760
例外の正しい扱い方 そのエラー try-catchして大丈夫?
jinwatanabe
0
260
Featured
See All Featured
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
590
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
200
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
750
Being A Developer After 40
akosma
91
590k
Fashionably flexible responsive web design (full day workshop)
malarkey
408
66k
Building Flexible Design Systems
yeseniaperezcruz
330
40k
Technical Leadership for Architectural Decision Making
baasie
3
420
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.8k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
Bash Introduction
62gerente
615
220k
Between Models and Reality
mayunak
4
340
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.5k
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!