<?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>Style sheet &#8211; stoimen&#039;s web log</title>
	<atom:link href="/tag/style-sheet/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>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>Optimizing CSS. Five simple steps!</title>
		<link>/2010/01/30/optimizing-css-five-simple-steps/</link>
		<comments>/2010/01/30/optimizing-css-five-simple-steps/#respond</comments>
		<pubDate>Sat, 30 Jan 2010 07:04:40 +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[DOM]]></category>
		<category><![CDATA[Google Inc.]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[Minification]]></category>
		<category><![CDATA[Software engineering]]></category>
		<category><![CDATA[software minifies]]></category>
		<category><![CDATA[sprite]]></category>
		<category><![CDATA[Steve Souders]]></category>
		<category><![CDATA[Style sheet]]></category>
		<category><![CDATA[Technology/Internet]]></category>
		<category><![CDATA[Web design]]></category>

		<guid isPermaLink="false">/?p=872</guid>
		<description><![CDATA[In the spirit of the optimization wave this post is about CSS optimization. There are some simple rules that you can apply. I’m pretty sure most of us have already been familiar with that list, but you never know. 1. Minify As the JavaScript the CSS also can be minified. This only strips every character &#8230; <a href="/2010/01/30/optimizing-css-five-simple-steps/" class="more-link">Continue reading <span class="screen-reader-text">Optimizing CSS. Five simple steps!</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="/2011/01/07/more-on-css-optimization/" rel="bookmark" title="More on CSS Optimization">More on CSS Optimization </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/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>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>In the spirit of the optimization wave this post is about CSS optimization. There are some simple rules that you can apply. I’m pretty sure most of us have already been familiar with that list, but you never know.</p>
<h3>1. Minify</h3>
<p>As the JavaScript the CSS also can be minified. This only strips every character that makes the traffic bigger. As you know a well constructed and pretty looking CSS file consists of many new lines, tabs and spaces. Almost every software minifies the CSS by simply removing them. Some of the programs go even further with replacements of different parts of the code considered to be not efficient.</p>
<h3>2. Use effective selectors</h3>
<p>Some CSS selectors aren’t really efficient. Imagine something like: body div a just to describe only one specific link. That’s really bad. Better practice is to replace that line with something like a.my-class and to replace the a tag into the DOM with that class name. That will be far more effective. Actually if you’re wondering how to find such bad selectors, there’s a tool by Google called Page Speed that’s a Firebug’s plugin and can extract a list of all bad selectors.</p>
<h3>3. Inheritance</h3>
<p>CSS is really powerful when dealing with inheritance. That’s something that is not some clear but however really powerful. This technique is in the basics of the next rule.</p>
<h3>4. Sprites</h3>
<p>I’ve written already about CSS sprites. This is nothing new, but be careful when making a new site’s layout. CSS sprites spend you HTTP request and that’s rule number one according to Steve Souders’ list of optimization.</p>
<h3>5. Separate logic</h3>
<p>Sometimes developers put the site logic in only one file that become to large. Be aware of that. This is hard to maintain and you load things that you don’t need.</p>
<p>That’s a really short list of what you can do with CSS to speed the site up. I hope that can help someone when dealing with cascading style sheets.</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="/2011/01/07/more-on-css-optimization/" rel="bookmark" title="More on CSS Optimization">More on CSS Optimization </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/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>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/01/30/optimizing-css-five-simple-steps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What if your site doesn&#8217;t use all of the CSS selectors?</title>
		<link>/2010/01/18/what-if-your-site-doesnt-use-all-of-the-css-selectors/</link>
		<comments>/2010/01/18/what-if-your-site-doesnt-use-all-of-the-css-selectors/#respond</comments>
		<pubDate>Mon, 18 Jan 2010 19:59:09 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[brilliant solution]]></category>
		<category><![CDATA[Cascading Style Sheets]]></category>
		<category><![CDATA[CssQuery]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[large web]]></category>
		<category><![CDATA[Style sheet]]></category>
		<category><![CDATA[Technology/Internet]]></category>
		<category><![CDATA[Web design]]></category>

		<guid isPermaLink="false">/?p=903</guid>
		<description><![CDATA[Why my site doesn’t use all of the CSS however? Well someone can ask how you can have CSS that contains selectors that aren’t used on the site. There are two reasons to happen and most of the cases both of them are true. The first reason is that not all of the pages in &#8230; <a href="/2010/01/18/what-if-your-site-doesnt-use-all-of-the-css-selectors/" class="more-link">Continue reading <span class="screen-reader-text">What if your site doesn&#8217;t use all of the CSS selectors?</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<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/30/optimizing-css-five-simple-steps/" rel="bookmark" title="Optimizing CSS. Five simple steps!">Optimizing CSS. Five simple steps! </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>
<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>Why my site doesn’t use all of the CSS however?</h2>
<p>Well someone can ask how you can have CSS that contains selectors that aren’t used on the site. There are two reasons to happen and most of the cases both of them are true.</p>
<p>The first reason is that not all of the pages in a site need all of the selectors. Imagine large web based application with lines of CSS and one of the sites’ pages is the “about” page where you’ve only the header, the footer and some text. That’s my favorite example! In fact you don’t need to load the whole CSS file just to apply only few selectors for this page. In most of the cases this is the reason to have unused selectors.</p>
<p>The second reason is that during the development process most of the code become old and therefore unused. You start by writing some CSS selectors which after changing the requirements, and the layout are no longer used. But the fear to ruine the layout because some other page can break after the removal of some selectors make the CSS to grow and fill with unused code.</p>
<p>Now you can overcome this problem by simply using a software (JavaScript) that helps you determine which selectors are never used. Check out this brilliant solution called <a title="helium" href="http://github.com/geuis/helium-css" target="_blank">helium</a>.</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<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/30/optimizing-css-five-simple-steps/" rel="bookmark" title="Optimizing CSS. Five simple steps!">Optimizing CSS. Five simple steps! </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>
<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/01/18/what-if-your-site-doesnt-use-all-of-the-css-selectors/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
