<?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>Cascading Style Sheets &#8211; stoimen&#039;s web log</title>
	<atom:link href="/tag/cascading-style-sheets/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>More on CSS Optimization</title>
		<link>/2011/01/07/more-on-css-optimization/</link>
		<comments>/2011/01/07/more-on-css-optimization/#comments</comments>
		<pubDate>Fri, 07 Jan 2011 14:40:14 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[Cascading Style Sheets]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[Minification]]></category>
		<category><![CDATA[possible solution]]></category>
		<category><![CDATA[Software engineering]]></category>
		<category><![CDATA[Style sheet]]></category>
		<category><![CDATA[Technology/Internet]]></category>
		<category><![CDATA[Web application]]></category>
		<category><![CDATA[web applications]]></category>
		<category><![CDATA[Web design]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[web programming]]></category>

		<guid isPermaLink="false">/?p=2101</guid>
		<description><![CDATA[As CSS files are first downloaded to the client and then executed, the main optimization is to make those files smaller. But that doesn&#8217;t mean only minifing! The Minification Process While with minification you can strip all the symbols that only take space, but are useless when the browser parses the file, there are some &#8230; <a href="/2011/01/07/more-on-css-optimization/" class="more-link">Continue reading <span class="screen-reader-text">More on CSS Optimization</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/01/30/optimizing-css-five-simple-steps/" rel="bookmark" title="Optimizing CSS. Five simple steps!">Optimizing CSS. Five simple steps! </a></li>
<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="/2010/02/10/manage-javascript-and-css-includes-within-zend-framework-application/" rel="bookmark" title="Manage JavaScript and CSS includes within Zend Framework application">Manage JavaScript and CSS includes within Zend Framework application </a></li>
<li><a href="/2010/01/18/what-if-your-site-doesnt-use-all-of-the-css-selectors/" rel="bookmark" title="What if your site doesn&#8217;t use all of the CSS selectors?">What if your site doesn&#8217;t use all of the CSS selectors? </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>As CSS files are first downloaded to the client and then executed, the main optimization is to make those files smaller. But that doesn&#8217;t mean only minifing!</p>
<p><a href="/wp-content/uploads/2011/01/css.jpg"><img class="alignleft size-full wp-image-2122" title="css" src="/wp-content/uploads/2011/01/css.jpg" alt="CSS" width="400" height="300" srcset="/wp-content/uploads/2011/01/css.jpg 400w, /wp-content/uploads/2011/01/css-300x225.jpg 300w" sizes="(max-width: 400px) 100vw, 400px" /></a><br />
<br clear="all" /></p>
<h2>The Minification Process</h2>
<p>While with minification you can strip all the symbols that only take space, but are useless when the browser parses the file, there are some other techniques, which in fact aren&#8217;t so simple, to speed up the loading process. By minification you get rid of the white spaces, tabs, new lines, etc., but the file may remain too large.</p>
<h2>Useless Rules</h2>
<p>Yes, sadly the browser doesn&#8217;t need all those white spaces, actually web developers need them. Just because this makes the file more readable, or readable at all. However most of the web applications have one large CSS file, typically named layout.css, main.css or whatever, that contains all the rules for the entire application. In many of the cases one page of a site doesn&#8217;t need all the rules for the site, so a possible solution is to remove all of the rules that aren&#8217;t used.</p>
<p>There are tools that may help you do the job. Such a tool, that I&#8217;m using is the Firefox add-on &#8211; <a title="Dust-Me Selectors" href="https://addons.mozilla.org/en-US/firefox/addon/5392/" target="_blank">Dust-Me Selectors</a>. Of course there are a lot other tools doing the same job, so it&#8217;s up to you to pick up one.</p>
<p>After removing all those useless rules you&#8217;ll see that the size of the file can be something like 20% of the size of the source file. This is interesting to note, because most of the time the minification cannot give you such performance benefit. In fact this comes with some issues.</p>
<h2>One Request or What?</h2>
<p>This is the dilemma of the web programming, isn&#8217;t it? However thus you can split the main CSS file to few smaller files, but they are named differently so you cannot expect the browser to cache them when the user visits the site for the first time.</p>
<p>The case must be, of course, tested against various situations, so you can decide what suits you. However the typical scenario is to optimize only few of the pages, as they might be the most visited &#8211; as for example the homepage. If two of the pages are mainly visited, than you can make custom, small, CSS files for them with only the necessary rules, and let the other pages with the main CSS file. If you&#8217;ve a lot of returning visitors, you can be sure the custom files will be cached (if the client cache is turned on) and the second time somebody visits the &#8220;homepage&#8221; for example the page will load faster.</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/01/30/optimizing-css-five-simple-steps/" rel="bookmark" title="Optimizing CSS. Five simple steps!">Optimizing CSS. Five simple steps! </a></li>
<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="/2010/02/10/manage-javascript-and-css-includes-within-zend-framework-application/" rel="bookmark" title="Manage JavaScript and CSS includes within Zend Framework application">Manage JavaScript and CSS includes within Zend Framework application </a></li>
<li><a href="/2010/01/18/what-if-your-site-doesnt-use-all-of-the-css-selectors/" rel="bookmark" title="What if your site doesn&#8217;t use all of the CSS selectors?">What if your site doesn&#8217;t use all of the CSS selectors? </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2011/01/07/more-on-css-optimization/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>CSS word-wrap to Wrap Long Words</title>
		<link>/2010/04/17/css-word-wrap-to-wrap-long-words/</link>
		<comments>/2010/04/17/css-word-wrap-to-wrap-long-words/#comments</comments>
		<pubDate>Sat, 17 Apr 2010 11:54:30 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[web development]]></category>
		<category><![CDATA[Cascading Style Sheets]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[html]]></category>

		<guid isPermaLink="false">/?p=1450</guid>
		<description><![CDATA[So you have a very very long word in some HTML element: verylongwordverylongwordverylongwordverylongwordverylongwordverylongwordverylongwordverylongwordverylongwordverylongwordverylongwordverylongwordverylongwordverylongwordverylongwordverylongwordverylongword As you can see what we miss is line breaks. This is a rare situation, but it may occur when you paste links or something. So the question is how to fix it. Pure CSS needed Simply add a fixed width and &#8230; <a href="/2010/04/17/css-word-wrap-to-wrap-long-words/" class="more-link">Continue reading <span class="screen-reader-text">CSS word-wrap to Wrap Long Words</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/01/18/what-if-your-site-doesnt-use-all-of-the-css-selectors/" rel="bookmark" title="What if your site doesn&#8217;t use all of the CSS selectors?">What if your site doesn&#8217;t use all of the CSS selectors? </a></li>
<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="/2010/02/12/css-border-radius-vs-images/" rel="bookmark" title="CSS border-radius vs. images!">CSS border-radius vs. images! </a></li>
<li><a href="/2010/02/15/css-selectors-new-look-over-them/" rel="bookmark" title="CSS selectors &#8211; new look over them">CSS selectors &#8211; new look over them </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>So you have a very very long word in some HTML element:</p>
<div style="width:430px;overflow:auto;">
verylongwordverylongwordverylongwordverylongwordverylongwordverylongwordverylongwordverylongwordverylongwordverylongwordverylongwordverylongwordverylongwordverylongwordverylongwordverylongwordverylongword
</div>
<p>As you can see what we miss is line breaks. This is a rare situation, but it may occur when you paste links or something. So the question is how to fix it.</p>
<h2>Pure CSS needed</h2>
<p>Simply add a fixed width and word-wrap.</p>
<pre lang="css">width:400px;
word-wrap:break-word;
</pre>
<p>Now the result is obvious:</p>
<div style="word-wrap: break-word; width:430px;"> verylongwordverylongwordverylongwordverylongwordverylongwordverylongwordverylongwordverylongwordverylongwordverylongwordverylongwordverylongwordverylongwordverylongwordverylongwordverylongwordverylongword
</div>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/01/18/what-if-your-site-doesnt-use-all-of-the-css-selectors/" rel="bookmark" title="What if your site doesn&#8217;t use all of the CSS selectors?">What if your site doesn&#8217;t use all of the CSS selectors? </a></li>
<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="/2010/02/12/css-border-radius-vs-images/" rel="bookmark" title="CSS border-radius vs. images!">CSS border-radius vs. images! </a></li>
<li><a href="/2010/02/15/css-selectors-new-look-over-them/" rel="bookmark" title="CSS selectors &#8211; new look over them">CSS selectors &#8211; new look over them </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/04/17/css-word-wrap-to-wrap-long-words/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Vendor Prefixes in CSS</title>
		<link>/2010/03/27/vendor-prefixes-in-css/</link>
		<comments>/2010/03/27/vendor-prefixes-in-css/#respond</comments>
		<pubDate>Sat, 27 Mar 2010 16:36:43 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[Cascading Style Sheets]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[Free software]]></category>
		<category><![CDATA[FTP clients]]></category>
		<category><![CDATA[Internet Explorer]]></category>
		<category><![CDATA[Mozilla]]></category>
		<category><![CDATA[Web design]]></category>
		<category><![CDATA[World Wide Web]]></category>

		<guid isPermaLink="false">/?p=1400</guid>
		<description><![CDATA[Vendor Prefixes vs CSS3 Either are bad, because vendor prefixes work on specific browsers, while CSS3 is not implemented fully by those browsers. When talking about vendor prefixes in CSS, let me tell you in breve, what&#8217;s this. If you&#8217;d like to make rounded corner under Mozilla Firefox, you usually use a background image, but &#8230; <a href="/2010/03/27/vendor-prefixes-in-css/" class="more-link">Continue reading <span class="screen-reader-text">Vendor Prefixes in CSS</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/02/12/css-border-radius-vs-images/" rel="bookmark" title="CSS border-radius vs. images!">CSS border-radius vs. images! </a></li>
<li><a href="/2010/02/17/htc-round-the-corners-on-ie/" rel="bookmark" title="HTC?! Round the corners on IE!">HTC?! Round the corners on IE! </a></li>
<li><a href="/2010/02/04/css-effective-selector/" rel="bookmark" title="CSS effective selector">CSS effective selector </a></li>
<li><a href="/2010/03/11/css-priority-the-difference-between-a-my-class-and-my-class/" rel="bookmark" title="CSS Priority: The Difference Between a.my-class and .my-class">CSS Priority: The Difference Between a.my-class and .my-class </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>Vendor Prefixes vs CSS3</h2>
<p>Either are bad, because vendor prefixes work on specific browsers, while CSS3 is not implemented fully by those browsers. When talking about vendor prefixes in CSS, let me tell you in breve, what&#8217;s this. If you&#8217;d like to make rounded corner under Mozilla Firefox, you usually use a background image, but there&#8217;s another way to do it &#8211; with Mozilla specific CSS:</p>
<pre lang="css">-moz-border-radius: 5px;
</pre>
<p>That&#8217;s bad because it works only on Mozilla based browsers, although there&#8217;s a webkit based similar syntax:</p>
<pre lang="css">-webkit-border-radius: 5px;
</pre>
<p>Even after that our &#8220;favorite&#8221; browser MSIE until version 9 is not displaying any rounded corners.</p>
<p>In other hand CSS3 gives us the possibility to write the simple:</p>
<pre lang="css">border-radius:5px;
</pre>
<p>which is not implemented in many currently used browsers, but it may be used for progressive enhancements.</p>
<h2>In Breve &#8230;</h2>
<p>Everybody&#8217;s talking about vendor prefixes after the famous <a href="http://www.quirksmode.org/blog/archives/2010/03/css_vendor_pref.html" target="_blank">post of PPK</a>, but there are both opinions &#8211; pros and cons. However it&#8217;s good to use it, but very carefully, and think about what CSS3 may give you!</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/02/12/css-border-radius-vs-images/" rel="bookmark" title="CSS border-radius vs. images!">CSS border-radius vs. images! </a></li>
<li><a href="/2010/02/17/htc-round-the-corners-on-ie/" rel="bookmark" title="HTC?! Round the corners on IE!">HTC?! Round the corners on IE! </a></li>
<li><a href="/2010/02/04/css-effective-selector/" rel="bookmark" title="CSS effective selector">CSS effective selector </a></li>
<li><a href="/2010/03/11/css-priority-the-difference-between-a-my-class-and-my-class/" rel="bookmark" title="CSS Priority: The Difference Between a.my-class and .my-class">CSS Priority: The Difference Between a.my-class and .my-class </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/03/27/vendor-prefixes-in-css/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS Priority: The Difference Between a.my-class and .my-class</title>
		<link>/2010/03/11/css-priority-the-difference-between-a-my-class-and-my-class/</link>
		<comments>/2010/03/11/css-priority-the-difference-between-a-my-class-and-my-class/#comments</comments>
		<pubDate>Thu, 11 Mar 2010 14:58:28 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[Cascading Style Sheets]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[firebug]]></category>
		<category><![CDATA[Google Inc.]]></category>
		<category><![CDATA[Span and div]]></category>
		<category><![CDATA[Web design]]></category>

		<guid isPermaLink="false">/?p=1222</guid>
		<description><![CDATA[Do You Know What&#8217;s an Inefficient CSS Selector? Perhaps! I was curious how can inefficient selectors impact a page performance. To begin with this topic let me say that inefficient selector is referred usually as nested selector: div span div { border:1px solid red; } as you can see here there are three nested tags &#8230; <a href="/2010/03/11/css-priority-the-difference-between-a-my-class-and-my-class/" class="more-link">Continue reading <span class="screen-reader-text">CSS Priority: The Difference Between a.my-class and .my-class</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/02/04/css-effective-selector/" rel="bookmark" title="CSS effective selector">CSS effective selector </a></li>
<li><a href="/2010/01/30/optimizing-css-five-simple-steps/" rel="bookmark" title="Optimizing CSS. Five simple steps!">Optimizing CSS. Five simple steps! </a></li>
<li><a href="/2010/01/18/what-if-your-site-doesnt-use-all-of-the-css-selectors/" rel="bookmark" title="What if your site doesn&#8217;t use all of the CSS selectors?">What if your site doesn&#8217;t use all of the CSS selectors? </a></li>
<li><a href="/2010/02/15/css-selectors-new-look-over-them/" rel="bookmark" title="CSS selectors &#8211; new look over them">CSS selectors &#8211; new look over them </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>Do You Know What&#8217;s an Inefficient CSS Selector?</h2>
<p>Perhaps! I was curious how can inefficient selectors impact a page performance. To begin with this topic let me say that inefficient selector is referred usually as nested selector:</p>
<pre lang="css">div span div {
    border:1px solid red;
}
</pre>
<p>as you can see here there are three nested tags I use to reference the innermost div. If you&#8217;re wondering how you&#8217;d know about inefficient selectors &#8211; well there is a plugin for the <a title="Firebug" href="http://getfirebug.com/" target="_blank">Firebug</a> written by a Google team called <a title="Page Speed" href="http://code.google.com/speed/page-speed/" target="_blank">Page Speed</a> explaining which of your selectors are inefficient. See the image below.</p>
<p><a href="/wp-content/uploads/2010/03/css-selectors-inefficient1.png"><img class="aligncenter size-full wp-image-1273" title="css-selectors-inefficient" src="/wp-content/uploads/2010/03/css-selectors-inefficient1.png" alt="CSS Page Speed Inefficient Selectors" width="430" height="113" srcset="/wp-content/uploads/2010/03/css-selectors-inefficient1.png 430w, /wp-content/uploads/2010/03/css-selectors-inefficient1-300x78.png 300w" sizes="(max-width: 430px) 100vw, 430px" /></a></p>
<p>In the <a title="CSS Performance Demo" href="http://www.stoimen.com/projects/css.selectors.performance/" target="_blank">demo</a> page you can find what I was trying to achieve and you can play around with that code to measure by yourself the performance of the different selectors.</p>
<h2>So who&#8217;s faster? Nested, IDs or Classes?</h2>
<p>Actually its pretty though to say. Yet another surprise for me was to notice that the notation:</p>
<pre lang="css">div.my-class {}
</pre>
<p>was a bit slower than the marked as <em>&#8220;inefficient&#8221;</em> by Page Speed:</p>
<pre lang="css">div span div {}
</pre>
<p>Another good thing to mention is that there is a difference between div.my-class and .my-class</p>
<h2>Question&#8217;s answer &#8230;</h2>
<p>In fact <strong>div.my-class</strong> is always with a higher priority than <strong>.my-class</strong> even if you&#8217;ve the following code:</p>
<pre lang="css">div.my-class {
    border:1px solid red;
}

.my-class {
    border:1px solid blue;
}

div span div {
    border:1px solid black;
}
</pre>
<p>And the computed style for Firefox was &#8230;</p>
<p><a href="/wp-content/uploads/2010/03/css-selectors-code.png"><img class="aligncenter size-full wp-image-1274" title="css-selectors-code" src="/wp-content/uploads/2010/03/css-selectors-code.png" alt="CSS Selector Performance Computed Style" width="430" height="170" srcset="/wp-content/uploads/2010/03/css-selectors-code.png 430w, /wp-content/uploads/2010/03/css-selectors-code-300x118.png 300w" sizes="(max-width: 430px) 100vw, 430px" /></a></p>
<p>where &#8220;div span div&#8221; chain matches the same elements as the previous selectors, as you can see:</p>
<p><a href="/wp-content/uploads/2010/03/css-selectors-dom-view.png"><img class="aligncenter size-full wp-image-1275" title="css-selectors-dom-view" src="/wp-content/uploads/2010/03/css-selectors-dom-view.png" alt="CSS Selector DOM View" width="430" height="127" srcset="/wp-content/uploads/2010/03/css-selectors-dom-view.png 430w, /wp-content/uploads/2010/03/css-selectors-dom-view-300x88.png 300w" sizes="(max-width: 430px) 100vw, 430px" /></a></p>
<p>so even that <strong>div.my-class</strong> will be the most important and finally the element will get its red border! It does not depend only on where you put the CSS rules, but also on how they are defined.</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/02/04/css-effective-selector/" rel="bookmark" title="CSS effective selector">CSS effective selector </a></li>
<li><a href="/2010/01/30/optimizing-css-five-simple-steps/" rel="bookmark" title="Optimizing CSS. Five simple steps!">Optimizing CSS. Five simple steps! </a></li>
<li><a href="/2010/01/18/what-if-your-site-doesnt-use-all-of-the-css-selectors/" rel="bookmark" title="What if your site doesn&#8217;t use all of the CSS selectors?">What if your site doesn&#8217;t use all of the CSS selectors? </a></li>
<li><a href="/2010/02/15/css-selectors-new-look-over-them/" rel="bookmark" title="CSS selectors &#8211; new look over them">CSS selectors &#8211; new look over them </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/03/11/css-priority-the-difference-between-a-my-class-and-my-class/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>CSS right to left direction &#038; floating elements</title>
		<link>/2010/03/08/css-right-to-left-direction-floating-elements/</link>
		<comments>/2010/03/08/css-right-to-left-direction-floating-elements/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 15:38:54 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[Cascading Style Sheets]]></category>
		<category><![CDATA[Technology/Internet]]></category>
		<category><![CDATA[Web design]]></category>

		<guid isPermaLink="false">/?p=1190</guid>
		<description><![CDATA[direction:rtl When developing a website for Arabic one of the most common questions is how to get it work with a reverse direction. Actually there is the CSS property direction: .my-class { direction:rtl; } which makes the page right aligned. Floating elements &#8230; However sometimes there are elements on the page which are absolutely positioned &#8230; <a href="/2010/03/08/css-right-to-left-direction-floating-elements/" class="more-link">Continue reading <span class="screen-reader-text">CSS right to left direction &#038; floating elements</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/03/02/fast-way-to-manage-the-arabic-version-of-a-web-form/" rel="bookmark" title="Fast way to manage the Arabic version of a web form">Fast way to manage the Arabic version of a web form </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>
<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="/2010/01/24/css-default-position-value/" rel="bookmark" title="CSS default position value">CSS default position value </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>direction:rtl</h2>
<p>When developing a website for Arabic one of the most common questions is how to get it work with a reverse direction. Actually there is the CSS property direction:</p>
<pre lang="css">.my-class {
    direction:rtl;
}
</pre>
<p>which makes the page right aligned.</p>
<h2>Floating elements &#8230;</h2>
<p>However sometimes there are elements on the page which are absolutely positioned and the direction property doesn&#8217;t do the job. The solution is something like combining the two settings. Both direction and float. So something like:</p>
<pre lang="css">.my-class {
    float:left;
}
</pre>
<p>becomes something like:</p>
<pre lang="css">.my-class {
    float:right;
    direction:rtl;
}
</pre>
<p>and of course if you&#8217;ve something like margin-left it should become margin-right!</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/03/02/fast-way-to-manage-the-arabic-version-of-a-web-form/" rel="bookmark" title="Fast way to manage the Arabic version of a web form">Fast way to manage the Arabic version of a web form </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>
<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="/2010/01/24/css-default-position-value/" rel="bookmark" title="CSS default position value">CSS default position value </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/03/08/css-right-to-left-direction-floating-elements/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Cross-browser rounded corners! Works on IE but, but not on Opera!</title>
		<link>/2010/02/15/cross-browser-rounded-corners-works-on-ie-but-but-not-on-opera/</link>
		<comments>/2010/02/15/cross-browser-rounded-corners-works-on-ie-but-but-not-on-opera/#comments</comments>
		<pubDate>Mon, 15 Feb 2010 19:29:38 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[Cascading Style Sheets]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[Graphics file formats]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[Markup languages]]></category>
		<category><![CDATA[Vector graphics markup languages]]></category>
		<category><![CDATA[Vector Markup Language]]></category>
		<category><![CDATA[Web design]]></category>
		<category><![CDATA[Web standards]]></category>
		<category><![CDATA[World Wide Web]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">/?p=1091</guid>
		<description><![CDATA[What&#8217;s this that works on IE and any other browser, except on Opera?! Rounded Corners That was a strange answer. Who&#8217;s making rounded corners with CSS?! on IE and more important how? There is a way to make it, but not entirely with CSS and HTML. The solution is with VML a subset of XML &#8230; <a href="/2010/02/15/cross-browser-rounded-corners-works-on-ie-but-but-not-on-opera/" class="more-link">Continue reading <span class="screen-reader-text">Cross-browser rounded corners! Works on IE but, but not on Opera!</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/02/17/htc-round-the-corners-on-ie/" rel="bookmark" title="HTC?! Round the corners on IE!">HTC?! Round the corners on IE! </a></li>
<li><a href="/2010/02/12/css-border-radius-vs-images/" rel="bookmark" title="CSS border-radius vs. images!">CSS border-radius vs. images! </a></li>
<li><a href="/2009/03/12/javascript-rounded-corners/" rel="bookmark" title="JavaScript rounded corners">JavaScript rounded corners </a></li>
<li><a href="/2010/03/27/vendor-prefixes-in-css/" rel="bookmark" title="Vendor Prefixes in CSS">Vendor Prefixes in CSS </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>What&#8217;s this that works on IE and any other browser, except on Opera?!</p>
<h2>Rounded Corners</h2>
<p>That was a strange answer. Who&#8217;s making rounded corners with CSS?! on IE and more important how? There is a way to make it, but not entirely with CSS and HTML. The solution is with VML a subset of XML to deal with vectors, and CSS of course.</p>
<p>The original solution I found on <a title="Rounded Corners experiment IE" href="http://snook.ca/archives/html_and_css/rounded_corners_experiment_ie/" target="_blank">snook.ca</a>.</p>
<p>It is really working fine as described and shown in the example, but there are some issues as well. There is no way to setup background image on the container, and the width and height are behaving strange.</p>
<p>However this gives you an opportunity to make cross browser rounded corners with no scripting that slows down the page and except Opera it&#8217;s quite working!</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/02/17/htc-round-the-corners-on-ie/" rel="bookmark" title="HTC?! Round the corners on IE!">HTC?! Round the corners on IE! </a></li>
<li><a href="/2010/02/12/css-border-radius-vs-images/" rel="bookmark" title="CSS border-radius vs. images!">CSS border-radius vs. images! </a></li>
<li><a href="/2009/03/12/javascript-rounded-corners/" rel="bookmark" title="JavaScript rounded corners">JavaScript rounded corners </a></li>
<li><a href="/2010/03/27/vendor-prefixes-in-css/" rel="bookmark" title="Vendor Prefixes in CSS">Vendor Prefixes in CSS </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/02/15/cross-browser-rounded-corners-works-on-ie-but-but-not-on-opera/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>CSS selectors &#8211; new look over them</title>
		<link>/2010/02/15/css-selectors-new-look-over-them/</link>
		<comments>/2010/02/15/css-selectors-new-look-over-them/#respond</comments>
		<pubDate>Mon, 15 Feb 2010 19:09:19 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[Cascading Style Sheets]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[CSS filter]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[JavaScript programming language]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[Software engineering]]></category>
		<category><![CDATA[Web design]]></category>

		<guid isPermaLink="false">/?p=1093</guid>
		<description><![CDATA[How do you select? When it comes to CSS selectors, most of us are using the most familiar selectors by id or class name. Something like: .my-class {} #my-id {} But as you can see in most of the big JavaScript libraries, such as jQuery, you can improve the selection of element/s by using complex &#8230; <a href="/2010/02/15/css-selectors-new-look-over-them/" class="more-link">Continue reading <span class="screen-reader-text">CSS selectors &#8211; new look over them</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/01/18/what-if-your-site-doesnt-use-all-of-the-css-selectors/" rel="bookmark" title="What if your site doesn&#8217;t use all of the CSS selectors?">What if your site doesn&#8217;t use all of the CSS selectors? </a></li>
<li><a href="/2010/03/11/css-priority-the-difference-between-a-my-class-and-my-class/" rel="bookmark" title="CSS Priority: The Difference Between a.my-class and .my-class">CSS Priority: The Difference Between a.my-class and .my-class </a></li>
<li><a href="/2010/01/30/optimizing-css-five-simple-steps/" rel="bookmark" title="Optimizing CSS. Five simple steps!">Optimizing CSS. Five simple steps! </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[<h2>How do you select?</h2>
<p>When it comes to CSS selectors, most of us are using the most familiar selectors by id or class name. Something like:</p>
<blockquote>
<pre>.my-class {}
#my-id {}
</pre>
</blockquote>
<p>But as you can see in most of the big JavaScript libraries, such as jQuery, you can improve the selection of element/s by using complex selector syntax.</p>
<h2>Do you know the syntax?</h2>
<p>Maybe yes, but maybe not! As I stumbled upon an interesting article on <a title="css tricks" href="http://css-tricks.com/" target="_blank">http://css-tricks.com/</a><br />
<a title="Permanent Link to The Skinny on CSS Attribute Selectors" rel="bookmark" href="http://css-tricks.com/attribute-selectors/">The Skinny on CSS Attribute Selectors.</a><br />
The good part is that now you can use this powerful selector syntax to improve CSS.</p>
<h2>Browsers</h2>
<p>Because this is the most interesting part &#8211; yes it is supported by MSIE, and no &#8211; not before IE7, be careful if you&#8217;d like to support it.</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/01/18/what-if-your-site-doesnt-use-all-of-the-css-selectors/" rel="bookmark" title="What if your site doesn&#8217;t use all of the CSS selectors?">What if your site doesn&#8217;t use all of the CSS selectors? </a></li>
<li><a href="/2010/03/11/css-priority-the-difference-between-a-my-class-and-my-class/" rel="bookmark" title="CSS Priority: The Difference Between a.my-class and .my-class">CSS Priority: The Difference Between a.my-class and .my-class </a></li>
<li><a href="/2010/01/30/optimizing-css-five-simple-steps/" rel="bookmark" title="Optimizing CSS. Five simple steps!">Optimizing CSS. Five simple steps! </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>/2010/02/15/css-selectors-new-look-over-them/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS border-radius vs. images!</title>
		<link>/2010/02/12/css-border-radius-vs-images/</link>
		<comments>/2010/02/12/css-border-radius-vs-images/#respond</comments>
		<pubDate>Fri, 12 Feb 2010 09:24:22 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[Cascading Style Sheets]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[Internet Explorer]]></category>
		<category><![CDATA[Microsoft Corporation]]></category>
		<category><![CDATA[Mozilla]]></category>
		<category><![CDATA[Tableless web design]]></category>
		<category><![CDATA[Technology/Internet]]></category>
		<category><![CDATA[Web design]]></category>
		<category><![CDATA[web designers]]></category>
		<category><![CDATA[web developer]]></category>
		<category><![CDATA[WebKit]]></category>
		<category><![CDATA[World Wide Web]]></category>

		<guid isPermaLink="false">/?p=1082</guid>
		<description><![CDATA[Rounded corners This is one of the main problems of web design and development now, even if it sounds strange. The thing is that with round corners the elements become more nice and groovy and most of the web designers make such design templates. The problem than comes over the web developer who&#8217;s supposed to &#8230; <a href="/2010/02/12/css-border-radius-vs-images/" class="more-link">Continue reading <span class="screen-reader-text">CSS border-radius vs. images!</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/03/27/vendor-prefixes-in-css/" rel="bookmark" title="Vendor Prefixes in CSS">Vendor Prefixes in CSS </a></li>
<li><a href="/2010/02/17/htc-round-the-corners-on-ie/" rel="bookmark" title="HTC?! Round the corners on IE!">HTC?! Round the corners on IE! </a></li>
<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="/2010/02/15/cross-browser-rounded-corners-works-on-ie-but-but-not-on-opera/" rel="bookmark" title="Cross-browser rounded corners! Works on IE but, but not on Opera!">Cross-browser rounded corners! Works on IE but, but not on Opera! </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>Rounded corners</h2>
<p>This is one of the main problems of web design and development now, even if it sounds strange. The thing is that with round corners the elements become more nice and groovy and most of the web designers make such design templates. The problem than comes over the web developer who&#8217;s supposed to convert this into HTML and CSS. Of course it would be nice if all browsers support rounded corners in CSS, but they don&#8217;t and guess what IE fully doesn&#8217;t support it.</p>
<blockquote>
<pre>-moz and -webkit</pre>
</blockquote>
<p>Most of you have heart about this patches in CSS when you can use this prefixes for Mozilla based and Safari&#8217;s Webkit based browsers. Than you can use border radius with no pain, and you get the same effect as with using images.</p>
<blockquote>
<pre>-moz-border-radius : 4px;
-webkit-border-radius : 4px;
</pre>
</blockquote>
<p>Of course on IE this doesn&#8217;t work and the element remains with square corners. But what the question is, should we make both versions for non IE browsers without images and a version for the &#8220;great&#8221; MSIE and all of its versions?</p>
<h2>My answer is: no!</h2>
<p>Although many sites do that, see vimeo for instance, there&#8217;s no need to support that. As the rumor and the MSIE blog says in IE9 which is &#8230; coming soon there will be &#8211; <strong>border-radius</strong> property.</p>
<h2>That&#8217;s awesome!</h2>
<p>Finally Microsoft has done something good! So stop using background images! This is hard to maintain, difficult to make and it&#8217;s bad for the browser loading time, because of the extra images/sprites.</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/03/27/vendor-prefixes-in-css/" rel="bookmark" title="Vendor Prefixes in CSS">Vendor Prefixes in CSS </a></li>
<li><a href="/2010/02/17/htc-round-the-corners-on-ie/" rel="bookmark" title="HTC?! Round the corners on IE!">HTC?! Round the corners on IE! </a></li>
<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="/2010/02/15/cross-browser-rounded-corners-works-on-ie-but-but-not-on-opera/" rel="bookmark" title="Cross-browser rounded corners! Works on IE but, but not on Opera!">Cross-browser rounded corners! Works on IE but, but not on Opera! </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/02/12/css-border-radius-vs-images/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Manage JavaScript and CSS includes within Zend Framework application</title>
		<link>/2010/02/10/manage-javascript-and-css-includes-within-zend-framework-application/</link>
		<comments>/2010/02/10/manage-javascript-and-css-includes-within-zend-framework-application/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 07:29:18 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[zend framework]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[Cascading Style Sheets]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[JavaScript programming language]]></category>
		<category><![CDATA[Software engineering]]></category>
		<category><![CDATA[Style sheet]]></category>
		<category><![CDATA[Unobtrusive JavaScript]]></category>
		<category><![CDATA[Web 2.0]]></category>
		<category><![CDATA[Web design]]></category>
		<category><![CDATA[World Wide Web]]></category>

		<guid isPermaLink="false">/?p=1052</guid>
		<description><![CDATA[How to include JavaScript and CSS files? In Zend Framework there is a very elegant way to include CSS and JavaScript. Because in one single view of any action you cannot include a JavaScript or CSS because they wont be executed from the browser, you can simply use a helper. You can see the original &#8230; <a href="/2010/02/10/manage-javascript-and-css-includes-within-zend-framework-application/" class="more-link">Continue reading <span class="screen-reader-text">Manage JavaScript and CSS includes within Zend Framework application</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/06/24/zend-framework-inject-javascript-code-in-a-actionview/" rel="bookmark" title="Zend Framework: Inject JavaScript Code in a Action/View">Zend Framework: Inject JavaScript Code in a Action/View </a></li>
<li><a href="/2010/02/15/css-selectors-new-look-over-them/" rel="bookmark" title="CSS selectors &#8211; new look over them">CSS selectors &#8211; new look over them </a></li>
<li><a href="/2010/01/18/what-if-your-site-doesnt-use-all-of-the-css-selectors/" rel="bookmark" title="What if your site doesn&#8217;t use all of the CSS selectors?">What if your site doesn&#8217;t use all of the CSS selectors? </a></li>
<li><a href="/2010/01/30/optimizing-css-five-simple-steps/" rel="bookmark" title="Optimizing CSS. Five simple steps!">Optimizing CSS. Five simple steps! </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>How to include JavaScript and CSS files?</h2>
<p>In Zend Framework there is a very elegant way to include CSS and JavaScript. Because in one single view of any action you cannot include a JavaScript or CSS because they wont be executed from the browser, you can simply use a helper.</p>
<p>You can see the original source of how that&#8217;s done <a href="http://devzone.zend.com/article/11760-Managing-CSS-and-JavaScript-files-within-a-Zend-Framework-App" target="_blank">here</a>. And in breve you can include a JS file like so:</p>
<blockquote>
<pre>&lt;? $this-&gt;headScript()-&gt;appendFile('/media/js/global.js') ?&gt;</pre>
</blockquote>
<p>but where the problem is?</p>
<p>As a very good PHP point of view, there is really that way to include JS into the application. But a PHP point of view is not a JavaScript point of view so this solution is not the best one.</p>
<p>As almost everybody knows JavaScript blocks other content until it&#8217;s loaded and executed from the server and nowadays the most popular way to include JS is just before the closing <strong>&lt;body&gt;</strong> tag.</p>
<p>That&#8217;s why the ZF solution is not optimal. What we actually need as both PHP and JavaScript developers is a most robust solution!</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/06/24/zend-framework-inject-javascript-code-in-a-actionview/" rel="bookmark" title="Zend Framework: Inject JavaScript Code in a Action/View">Zend Framework: Inject JavaScript Code in a Action/View </a></li>
<li><a href="/2010/02/15/css-selectors-new-look-over-them/" rel="bookmark" title="CSS selectors &#8211; new look over them">CSS selectors &#8211; new look over them </a></li>
<li><a href="/2010/01/18/what-if-your-site-doesnt-use-all-of-the-css-selectors/" rel="bookmark" title="What if your site doesn&#8217;t use all of the CSS selectors?">What if your site doesn&#8217;t use all of the CSS selectors? </a></li>
<li><a href="/2010/01/30/optimizing-css-five-simple-steps/" rel="bookmark" title="Optimizing CSS. Five simple steps!">Optimizing CSS. Five simple steps! </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/02/10/manage-javascript-and-css-includes-within-zend-framework-application/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>CSS sprites. Go beyond the limits with base64!</title>
		<link>/2010/02/05/css-sprites-go-beyond-the-limits-with-base64/</link>
		<comments>/2010/02/05/css-sprites-go-beyond-the-limits-with-base64/#comments</comments>
		<pubDate>Fri, 05 Feb 2010 08:10:29 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[base64]]></category>
		<category><![CDATA[Cascading Style Sheets]]></category>
		<category><![CDATA[communication]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[Data URI scheme]]></category>
		<category><![CDATA[DOM]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[Minification]]></category>
		<category><![CDATA[sprite]]></category>
		<category><![CDATA[Stoyan Stefanov]]></category>
		<category><![CDATA[Technology/Internet]]></category>
		<category><![CDATA[URI scheme]]></category>
		<category><![CDATA[Web design]]></category>
		<category><![CDATA[Web page]]></category>
		<category><![CDATA[web projects]]></category>
		<category><![CDATA[web server]]></category>
		<category><![CDATA[World Wide Web]]></category>

		<guid isPermaLink="false">/?p=1055</guid>
		<description><![CDATA[Why should I optimize CSS? In fact how and why should I optimize CSS is the right question. Actually CSS is simply one ore more files loaded from the server to the client, usually a browser, with CSS specific rules that must be applied by the browser to the web page you&#8217;re seeing. That&#8217;s in &#8230; <a href="/2010/02/05/css-sprites-go-beyond-the-limits-with-base64/" class="more-link">Continue reading <span class="screen-reader-text">CSS sprites. Go beyond the limits with base64!</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2009/04/23/when-you-should-use-base64-for-images/" rel="bookmark" title="When you should use base64 for images">When you should use base64 for images </a></li>
<li><a href="/2010/01/30/optimizing-css-five-simple-steps/" rel="bookmark" title="Optimizing CSS. Five simple steps!">Optimizing CSS. Five simple steps! </a></li>
<li><a href="/2010/01/13/optimizing-the-web-start-with-the-images/" rel="bookmark" title="Optimizing the web. Start with the images!">Optimizing the web. Start with the images! </a></li>
<li><a href="/2011/01/07/more-on-css-optimization/" rel="bookmark" title="More on CSS Optimization">More on CSS Optimization </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>Why should I optimize CSS?</h2>
<p>In fact how and why should I optimize CSS is the right question. Actually CSS is simply one ore more files loaded from the server to the client, usually a browser, with CSS specific rules that must be applied by the browser to the web page you&#8217;re seeing. That&#8217;s in general. Of course there are exceptions when CSS can be inline or added directly to the HTML tags, which is bad practice because thus the HTML markup becomes larger and even worse the browser cannot cache it and than load it quickly. In fact that&#8217;s why usually the CSS of a web page is put in one single file. Primary because that makes only one request to the server and in second hand because it can be cached by the browser.</p>
<p>Just because the nature of the CSS is that firstly it&#8217;s loaded and than executed one of the primary techniques of optimizing it is to make it smaller and therefore load faster. There are several methods of doing so. Enabling GZIP support of the web server and minifying the file are the most common ones. But one of the tricks you cannot optimizing just for second is using the so called CSS sprites.</p>
<h2>CSS sprites</h2>
<p>What are these? To answer this question I&#8217;ll simply try to give you an example. Let&#8217;s assume there are three CSS classes each one with its own background image. This makes four requests to the server. One for the CSS file and one per every background image. But what we&#8217;d like to achieve is to make less requests as we can. Than one of the things we can do is to make one single image and to change only the background-position CSS property to position it on the right place and to make it appear correctly.</p>
<p>Be careful! When you join all of the images into one single CSS sprite you may add one class with that background-image and every other class with only background-position property. Than every DOM element with that background must have both class names. Only than you can be sure the server will make two requests. One for the CSS file and one for the sprite.</p>
<h2>base64 to encode images</h2>
<p>In other hand most of the web projects are pretty big, and unfortunately it&#8217;s too difficult to make only one single sprite just because it&#8217;s too difficult to manage it after the project has become very large. That&#8217;s why mostly in the practice there are several sprites for the main components. But the problem is that again there are more HTTP requests.</p>
<h3>Is there any way to make only one request?</h3>
<p>Yes there is. Simply by converting your CSS sprite into a base64 encoded image. In breve base64 is an encoding where you can practically make any data into a string. Thus the image can be represented by a string containing the same information as the image. Hopefully most of the browser, except of course MSIE, does read the so called data urls, or:</p>
<blockquote>
<pre>&lt;img src="data:image/png;base64,..... " /&gt;</pre>
</blockquote>
<p>and that&#8217;s enough to get started with base64 and the single request. The sprite has become a string!</p>
<h2>CSS and base64</h2>
<p>The natural question is now how to merge all this? You now have one CSS file with one or more sprites. Than you can convert them into a base64 encoded strings and put them all into the CSS.</p>
<p>There is a problem, of course, what happens with MSIE. As I said before MSIE doesn&#8217;t read base64 encoded images. Hopefully there is a solution described very well by <a href="http://phpied.com/" target="_blank">Stoyan Stefanov</a> in his <a href="http://www.phpied.com/data-uris-mhtml-ie7-win7-vista-blues/" target="_blank">blog post here</a>.</p>
<h2>Finally &#8230;</h2>
<p>now there is only one request and everything works pretty fine. This technique can be really helpful to someone who&#8217;s trying to optimize the CSS performance to the limits.</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2009/04/23/when-you-should-use-base64-for-images/" rel="bookmark" title="When you should use base64 for images">When you should use base64 for images </a></li>
<li><a href="/2010/01/30/optimizing-css-five-simple-steps/" rel="bookmark" title="Optimizing CSS. Five simple steps!">Optimizing CSS. Five simple steps! </a></li>
<li><a href="/2010/01/13/optimizing-the-web-start-with-the-images/" rel="bookmark" title="Optimizing the web. Start with the images!">Optimizing the web. Start with the images! </a></li>
<li><a href="/2011/01/07/more-on-css-optimization/" rel="bookmark" title="More on CSS Optimization">More on CSS Optimization </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/02/05/css-sprites-go-beyond-the-limits-with-base64/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
