<?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>SixCrayons &#187; best practises</title>
	<atom:link href="http://sixcrayons.com/tag/best-practises/feed/" rel="self" type="application/rss+xml" />
	<link>http://sixcrayons.com</link>
	<description>non-toxic designing</description>
	<lastBuildDate>Mon, 12 Apr 2010 14:33:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Simple Tips to Organise your CSS</title>
		<link>http://sixcrayons.com/2009/09/10/simple-tips-to-organise-your-css/</link>
		<comments>http://sixcrayons.com/2009/09/10/simple-tips-to-organise-your-css/#comments</comments>
		<pubDate>Thu, 10 Sep 2009 15:04:42 +0000</pubDate>
		<dc:creator>Dave Cartledge</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[best practises]]></category>

		<guid isPermaLink="false">http://sixcrayons.com/?p=357</guid>
		<description><![CDATA[Stylesheets can easily become large and unorganised if not properly structured. Planning ahead and careful organising is important to create a fast, manageable stylesheet. [...]]]></description>
			<content:encoded><![CDATA[<p class="first">Stylesheets can easily become large and unorganised if not properly structured. Planning ahead and careful organising is important to create a fast, manageable stylesheet. By sticking to these basic rules, you can write CSS that is leaner, faster and less likely to give you a headache.</p>
<h3 class="title">Plan ahead and keep organised</h3>
<p>Declare your main structural elements nearer to the top of the document, and then the less important elements further down. Use a structure that works best for you, and save a template for future use.</p>
<ol>
<li>Resets</li>
<li>Main Layout</li>
<li>Secondary Layout</li>
<li>Miscellaneous</li>
</ol>
<p>Break your stylesheet into modules:</p>
<pre>@import "/css/layout.css";
@import "/css/print.css";
@import "/css/typography.css";
@import "/css/forms.css";</pre>
<h3 class="title">Use Comments</h3>
<p>Each CSS file should have a commented area at the beginning of the document, which includes the date it was written, updated date and the author. Use comments to clearly define each section of code.</p>
<h3 class="title">Use Consistent and meaningful naming conventions</h3>
<p>Try to use names that will remain relevant over time. The ability to redesign your entire website by just modifying the CSS will be much harder if you use limiting names. Use versatile naming and stay consistent – use hyphens instead of underscores (some older browsers don’t like underscores) but use it consistently, eg:</p>
<pre>#Sub-Content { width:500px; background:#f2f2f2; }
#Advert-One { width:100px; background:#f2f2f2; padding:5px;}</pre>
<p>Not this:</p>
<pre>#SubContent { width:500px; background:#f2f2f2; }
#Advert-one { width:100px; background:#f2f2f2; padding:5px;}</pre>
<p>If you capitalise the first letter of each word, and separate with a hyphen – do this for <em>all</em> elements.</p>
<h3 class="title">Group elements and use shorthand</h3>
<p>Use groups to re-use attributes instead of declaring the styles again. This technique allows you to create compact yet powerful CSS rules.</p>
<p>So this:</p>
<pre>h3 {font-size: 12px; font-family: arial, helvetica, sans-serif;}
p {font-size: 12px; font-family: arial, helvetica, sans-serif;}</pre>
<p>Becomes this:</p>
<pre>h3, p {font-size: 12px; font-family: arial, helvetica, sans-serif;}</pre>
<p>Use shorthand to create optimised CSS:</p>
<pre>h3, p {font: 12px arial, helvetica, sans-serif;}</pre>
<h3 class="title">Validate</h3>
<p>Every stylesheet should be fully validated using the free <a href="http://jigsaw.w3.org/css-validator/">W3C CSS Validator</a>, and if you’ve got issues with your CSS not doing what you want it to, this can be a big help in rectifying any errors in your code.</p>
]]></content:encoded>
			<wfw:commentRss>http://sixcrayons.com/2009/09/10/simple-tips-to-organise-your-css/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

