<?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>schaerwebschaerweb | schaerweb</title>
	<atom:link href="http://schaerweb.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://schaerweb.com</link>
	<description>sharing the love for the web</description>
	<lastBuildDate>Mon, 11 Jul 2011 04:02:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Why you should use image sprites?</title>
		<link>http://schaerweb.com/2011/07/why-you-should-use-image-sprites/</link>
		<comments>http://schaerweb.com/2011/07/why-you-should-use-image-sprites/#comments</comments>
		<pubDate>Sat, 09 Jul 2011 20:27:34 +0000</pubDate>
		<dc:creator>martinschaer</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[best practices]]></category>
		<category><![CDATA[tool]]></category>

		<guid isPermaLink="false">http://schaerweb.com/?p=26</guid>
		<description><![CDATA[Ever wondered why image sprites exist if they make coding CSS image backgrounds harder? Do you think it is because it organizes images better? Not at all. So why? They are also harder to maintain when an image has to be updated. I forgot to ask in the first place: do you know what image sprites are? They are images in which you append all the images you are going to use in your CSS. Here&#8217;s an example from Amazon: The reason this is a best practice is because of how the HTTP protocol works, and because we want to minimize the time a webpage takes to load (there are many reasons why you should want to make your site load faster, one of them is because Google incorporated a while ago site speed in it&#8217;s ranking algorithm) HTTP is a non-connection based protocol, this means that for every request the browser does a new connection has to be done and the route to the server has to be recalculated. So, if every image was in the same file, the browser saves multiple requests. Google Page Speed Labs suggest using image sprites as medium priority, and gives important recommendations about. Combining [...]]]></description>
			<content:encoded><![CDATA[<p>Ever wondered why image sprites exist if they make coding CSS image backgrounds harder?</p>
<p>Do you think it is because it organizes images better? Not at all.</p>
<p>So why? They are also harder to maintain when an image has to be updated.</p>
<p>I forgot to ask in the first place: do you know what image sprites are? They are images in which you append all the images you are going to use in your CSS.</p>
<p>Here&#8217;s an example from <a href="http://amazon.com" target="_blank">Amazon</a>:</p>
<p><img class="aligncenter size-full wp-image-28" title="Amazon Sprites" src="http://schaerweb.com/wp-content/uploads/2011/07/amazonsprites.png" alt="Amazon sprites" width="605" height="540" /></p>
<p>The reason this is a best practice is because of how the <a title="Hypertext Transfer Protocol" href="http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol" target="_blank">HTTP protocol</a> works, and because we want to minimize the time a webpage takes to load (there are many reasons why you should want to make your site load faster, one of them is because <a title="Google incorporating site speed in search rankings" href="http://www.mattcutts.com/blog/site-speed/" target="_blank">Google incorporated a while ago site speed in it&#8217;s ranking algorithm</a>) HTTP is a non-connection based protocol, this means that for every request the browser does a new connection has to be done and the route to the server has to be recalculated. So, if every image was in the same file, the browser saves multiple requests.</p>
<p><a title="Page Speed Online" href="http://pagespeed.googlelabs.com/" target="_blank">Google Page Speed Labs</a> suggest using image sprites as medium priority, and gives important <a title="Combine images using CSS sprites" href="http://code.google.com/speed/page-speed/docs/rtt.html#SpriteImages" target="_blank">recommendations</a> about.</p>
<blockquote><p>Combining images into as few files as possible using CSS sprites reduces the number of round-trips and delays in downloading other resources, reduces request overhead, and can reduce the total number of bytes downloaded by a web page. &#8211; Google Page Speed Labs</p></blockquote>
<p>Every request the browser does is divided in steps: <em>DNS lookup, connecting, sending, waiting, receiving</em>. We can use <a title="Firebug and Network Monitoring" href="http://getfirebug.com/network" target="_blank">firebug</a> to see all of the requests done during the loading of a webpage.</p>
<div id="attachment_31" class="wp-caption aligncenter" style="width: 584px"><img class="size-full wp-image-31 " title="Firebug Net" src="http://schaerweb.com/wp-content/uploads/2011/07/firebugnet.png" alt="Firebug Net tab" width="574" height="240" /><p class="wp-caption-text">Net activity for image resources monitored by Firebug</p></div>
<p>I took a WordPress theme and measured the time taken for every image resource at each step (ok, <em>Firebug</em> did that, not me) and calculated that 38.8% of the time corresponds to <a title="Latency" href="http://en.wikipedia.org/wiki/Latency_(engineering)" target="_blank">latency</a> (in this case <em>latency = DNS lookup + connecting + sending</em>), while only 14.4% corresponds to downloading data (the 46.7% remaining corresponds to waiting for the server to respond). Latency time should be minimized, since it&#8217;s not time invested in actually downloading the resources the browser needs to show.</p>
<p>Steps <em>DNS lookup, connecting and sending</em> are redundant for every static image request on the same server. So, how can we cut them off? Guess what? Using image sprites! Every image request will be grouped in only one, resulting in only one set of latency time for all the image kilobytes the browser is going to download.</p>
<p>It is important to make clear that commonly not every image is grouped into one and only image sprite. As you could guess, image backgrounds will be left aside and images used in content too. Image sprites result being the container of icons, bullets, buttons, <a title="Sliding Doors of CSS" href="http://www.alistapart.com/articles/slidingdoors/" target="_blank">sliding doors</a> backgrounds, etc. And of course, sprites only contain equal images types (PNG or GIF).</p>
<p>It is highly unrecommended to make JPG sprites, because of how JPG images are compressed.</p>
<p><a title="The Mystery Of CSS Sprites" href="http://coding.smashingmagazine.com/2009/04/27/the-mystery-of-css-sprites-techniques-tools-and-tutorials/" target="_blank">This post about image sprites in Smashing Magazine</a> has articles with code examples, screencasts, techniques, sprite generators, etc.</p>
<p>If you are searching for a <strong>tool to make CSS sprites</strong>, I would recommend <a title="SpriteMe" href="http://spriteme.org" target="_blank">SpriteMe.org</a>. You&#8217;ll be amazed about what this tool is capable of: it suggests which images can be grouped in a sprite, it generates the sprite by its own, gives you the CSS code, and tests it live!</p>
<p>I hope you learnt something new, or fully understand the techy side of this, or at least enjoyed reading this article as I enjoyed writing it on my iPhone on a bus heading to <a title="Google Map: Ciudad Quesada, Costa Rica" href="http://maps.google.com/maps?q=Ciudad+Quesada,+Alajuela,+Costa+Rica&amp;hl=en&amp;sll=10.32104,-84.428726&amp;sspn=0.02795,0.045447&amp;z=15" target="_blank">Ciudad Quesada, Costa Rica</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://schaerweb.com/2011/07/why-you-should-use-image-sprites/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rubik&#8217;s Cubes are a good part of working environments</title>
		<link>http://schaerweb.com/2011/07/rubiks-cubes-are-a-good-part-of-working-environments/</link>
		<comments>http://schaerweb.com/2011/07/rubiks-cubes-are-a-good-part-of-working-environments/#comments</comments>
		<pubDate>Fri, 08 Jul 2011 06:30:51 +0000</pubDate>
		<dc:creator>martinschaer</dc:creator>
				<category><![CDATA[iPhonography]]></category>

		<guid isPermaLink="false">http://schaerweb.com/?p=20</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p><img class="aligncenter size-full wp-image-21" title="Rubik Cube" src="http://schaerweb.com/wp-content/uploads/2011/07/5814279630_9fb3b65f30_z.jpg" alt="Rubik Cube" width="612" height="612" /></p>
]]></content:encoded>
			<wfw:commentRss>http://schaerweb.com/2011/07/rubiks-cubes-are-a-good-part-of-working-environments/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pure CSS3 dialog bubble</title>
		<link>http://schaerweb.com/2011/07/pure-css3-dialog-bubble/</link>
		<comments>http://schaerweb.com/2011/07/pure-css3-dialog-bubble/#comments</comments>
		<pubDate>Fri, 08 Jul 2011 05:48:38 +0000</pubDate>
		<dc:creator>martinschaer</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS3]]></category>

		<guid isPermaLink="false">http://schaerweb.com/?p=8</guid>
		<description><![CDATA[I always try keep my HTML as simple as possible, specially when coding forms. Forms tend to requiere a lot of markup to make them look nice, to position the labels, to have useful hints, error messages, validations, etc. Using CSS3 to reduce the amount of HTML is ideal. In this case, I am using my friend selectors :before and :after to accomplish something that normally would require HTML code (supposing we are avoiding loading images). The HTML code is as simple as: And here&#8217;s the CSS: It&#8217;s important to use RGBA to specify alpha transparency so no matter the background color it always will look as a shadow. Thats means: less code to edit if a color changes.]]></description>
			<content:encoded><![CDATA[<p>I always try keep my HTML as simple as possible, specially when coding forms. Forms tend to requiere a lot of markup to make them look nice, to position the labels, to have useful hints, error messages, validations, etc. Using <strong>CSS3</strong> to reduce the amount of HTML is ideal.</p>
<p>In this case, I am using my friend selectors <code>:before</code> and <code>:after</code> to accomplish something that normally would require HTML code (supposing we are avoiding loading images).</p>
<p><img class="aligncenter size-full wp-image-11" title="CSS3 Dialog Bubble" src="http://schaerweb.com/wp-content/uploads/2011/07/css3dialogbubble.png" alt="CSS3 Dialog Bubble" width="502" height="87" /></p>
<p>The <strong>HTML</strong> code is as simple as:</p>
<pre class="brush: xml; title: ; notranslate">&lt;div class=&quot;bubble&quot;&gt;Hello World!&lt;/div&gt;</pre>
<p>And here&#8217;s the <strong>CSS</strong>:</p>
<pre class="brush: css; title: ; notranslate">/* the bubble is white, assuming it is floating over dark background */
.bubble{
color: #444;
background-color: #fff;

font-size: 24px;
height: 30px;
line-height: 1.2em;
padding: 0.2em 1em;

border-radius: 8px;
-moz-border-radius: 8px;
box-shadow: 5px 5px 0 rgba(0,0,0,0.25);
-moz-box-shadow: 5px 5px 0 rgba(0,0,0,0.25);
-webkit-box-shadow: 5px 5px 0 rgba(0,0,0,0.25);

/* positioning relative to its parent */
position: absolute;
bottom: 10px;
right: 10px;
}
.bubble:before,
.bubble:after{
border-bottom: 10px solid #fff;
content: &quot;&quot;;
height: 0px;
position: absolute;
right: -20px;
top: 10px;
width: 0px;
display: block;
border-right: 20px solid transparent;
}
.bubble:before{
top: 20px;
border-bottom: none;
border-top: 10px solid #fff;
}</pre>
<p>It&#8217;s important to use RGBA to specify alpha transparency so no matter the background color it always will look as a shadow. Thats means: less code to edit if a color changes.</p>
]]></content:encoded>
			<wfw:commentRss>http://schaerweb.com/2011/07/pure-css3-dialog-bubble/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

