<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>optimizations &#8211; stoimen&#039;s web log</title>
	<atom:link href="/tag/optimizations/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>on web development</description>
	<lastBuildDate>Tue, 13 Feb 2018 08:18:15 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.0.3</generator>
	<item>
		<title>CSS Sprites &#8211; common mistakes</title>
		<link>/2009/10/06/css-sprites-common-mistakes/</link>
		<comments>/2009/10/06/css-sprites-common-mistakes/#comments</comments>
		<pubDate>Tue, 06 Oct 2009 06:41:11 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[optimizations]]></category>
		<category><![CDATA[sprites]]></category>

		<guid isPermaLink="false">/?p=739</guid>
		<description><![CDATA[CSS Sprites Although there are so many resources about CSS sprites and where they should be used I still think their usage is misunderstood. The big problem is that many people use the sprite in a completely wrong way. When used properly the sprite can be really helpful, especially for a large scale site. The &#8230; <a href="/2009/10/06/css-sprites-common-mistakes/" class="more-link">Continue reading <span class="screen-reader-text">CSS Sprites &#8211; common mistakes</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/02/05/css-sprites-go-beyond-the-limits-with-base64/" rel="bookmark" title="CSS sprites. Go beyond the limits with base64!">CSS sprites. Go beyond the limits with base64! </a></li>
<li><a href="/2009/03/20/css-color-units/" rel="bookmark" title="CSS color units">CSS color units </a></li>
<li><a href="/2009/06/21/sprite-usage-and-website-optimization/" rel="bookmark" title="sprite usage and website optimization">sprite usage and website optimization </a></li>
<li><a href="/2009/11/04/jquery-css-selectors-change-one-or-more-css-properties/" rel="bookmark" title="jQuery CSS selectors. Change one or more CSS properties!">jQuery CSS selectors. Change one or more CSS properties! </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>CSS Sprites</p>
<p>Although there are so many resources about CSS sprites and where they should be used I still think their usage is misunderstood.</p>
<p>The big problem is that many people use the sprite in a completely wrong way. When used properly the sprite can be really helpful, especially for a large scale site.</p>
<h2>The mistake</h2>
<p>When you read about sprites and you understand you must use only one image you start doing the big mistake. Let&#8217;s assume we&#8217;ve one image for the backgrounds of three div elements:</p>
<blockquote>
<pre>.a {
    background: url(sprite.png) 10px 10px no-repeat;
}
.b {
    background: url(sprite.png) 20px 20px no-repeat;
}
.c {
    background: url(sprite.png) 30px 30px no-repeat;
}</pre>
<pre>&lt;div class="a"&gt;&lt;/div&gt;</pre>
<pre>&lt;div class="b"&gt;&lt;/div&gt;</pre>
<pre>&lt;div class="c"&gt;&lt;/div&gt;</pre>
</blockquote>
<p>Now even with this simple example there is one sprite image but the browser makes three requests for this image, which is really bad!</p>
<h2>The solution</h2>
<p>How about making it the right way with a simple change:</p>
<blockquote>
<pre>.sprite {
    background-image:url(sprite.png);
    background-repeat: no-repeat;
}
.a {
    background-position:0px 0px;
}
.b {
    background-position:10px 10px;
}
.c {
    background-position:20px 20px;
}</pre>
</blockquote>
<p>and a little bit different markup:</p>
<blockquote>
<pre>&lt;div class="sprite a"&gt;&lt;/div&gt;</pre>
<pre>&lt;div class="sprite b"&gt;&lt;/div&gt;</pre>
<pre>&lt;div class="sprite c"&gt;&lt;/div&gt;</pre>
</blockquote>
<p>and this is where the sprites are really useful. Now the browser makes only one request and your site is ready for the big world.</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/02/05/css-sprites-go-beyond-the-limits-with-base64/" rel="bookmark" title="CSS sprites. Go beyond the limits with base64!">CSS sprites. Go beyond the limits with base64! </a></li>
<li><a href="/2009/03/20/css-color-units/" rel="bookmark" title="CSS color units">CSS color units </a></li>
<li><a href="/2009/06/21/sprite-usage-and-website-optimization/" rel="bookmark" title="sprite usage and website optimization">sprite usage and website optimization </a></li>
<li><a href="/2009/11/04/jquery-css-selectors-change-one-or-more-css-properties/" rel="bookmark" title="jQuery CSS selectors. Change one or more CSS properties!">jQuery CSS selectors. Change one or more CSS properties! </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2009/10/06/css-sprites-common-mistakes/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
