<?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>Jared Lewandowski &#187; css</title>
	<atom:link href="http://jaredlewandowski.com/blog/tag/css/feed/" rel="self" type="application/rss+xml" />
	<link>http://jaredlewandowski.com/blog</link>
	<description></description>
	<lastBuildDate>Tue, 02 Mar 2010 18:46:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>Writing Good CSS</title>
		<link>http://jaredlewandowski.com/blog/2009/10/writing-good-css/</link>
		<comments>http://jaredlewandowski.com/blog/2009/10/writing-good-css/#comments</comments>
		<pubDate>Fri, 02 Oct 2009 16:54:17 +0000</pubDate>
		<dc:creator>Jared Lewandowski</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[css]]></category>

		<guid isPermaLink="false">http://jaredlewandowski.com/blog/?p=323</guid>
		<description><![CDATA[It’s really easy to find yourself wondering how your CSS got to be such a mess. Sometimes it’s the result of sloppy coding from the start, sometimes it’s because of multiple hacks and changes over time. Whatever the cause, it doesn’t have to be that way. Writing clean, super-manageable CSS is simple when you start [...]]]></description>
			<content:encoded><![CDATA[<p><img class="size-medium wp-image-423 alignleft" title="css_reset" src="http://jaredlewandowski.com/blog/wp-content/uploads/2009/10/css_reset-300x200.jpg" alt="css_reset" width="216" height="144" /></p>
<p>It’s really easy to find yourself wondering how your CSS got to be such a mess.</p>
<p>Sometimes it’s the result of sloppy coding from the start, sometimes it’s because of multiple hacks and changes over time.</p>
<p>Whatever the cause, it doesn’t have to be that way. Writing clean, super-manageable CSS is simple when you start off on the right foot and make your code easier to maintain and edit later on.</p>
<p>Here are three tips for speeding up the process, writing CSS that is slimmer, faster and less likely to give you (or those you work with) a headache.</p>
<h3>1.) Stay Organized</h3>
<p>Just like anything else, it pays to keep yourself organized. Rather than haphazardly dropping in id’s and classes in the order in which they come to mind, use a coherent structure.</p>
<p>It will help you keep the cascading part of CSS in mind and sets your style sheet up to take advantage of style inheritance.</p>
<p><strong>Declare your most generic items first, then the not-so-generic and so on.</strong> This lets your CSS properly inherit attributes and makes it much easier for you to override a specific style when you need to. You’ll be faster at editing your CSS later because it will follow an easy to read, logical structure.</p>
<p>Use a structure that works best for you while keeping future edits and other developers in mind.</p>
<p><img class="size-full wp-image-335 alignnone" title="best-css-02" src="http://jaredlewandowski.com/blog/wp-content/uploads/2009/05/best-css-02.jpg" alt="best-css-02" width="358" height="668" /></p>
<h3>2.) Don&#8217;t Repeat Yourself</h3>
<p>Re-use attributes whenever possible by grouping elements instead of declaring the styles again. If your h1 and h2 elements both use the same font size, color and margins, group them using a comma.</p>
<p><img class="alignnone size-full wp-image-328" title="best-css-05" src="http://jaredlewandowski.com/blog/wp-content/uploads/2009/05/best-css-05.jpg" alt="best-css-05" width="358" height="274" /></p>
<h3>3.) Use Useful Naming Conventions</h3>
<p>You’ll notice above where I declared a couple of column id’s and I called them col-alpha and col-beta. Why not just call them col-left and col-right? Think of future edits, always.</p>
<p>Next year you may need to redesign your site and move that left column to the right. You shouldn’t have to rename the element in your HTML and rename the id in your style sheet just to change its position.</p>
<p>Sure, you could just reposition that left column to the right and keep the id as #col-left, but how confusing is that? If the id says left, one should expect that it will always be on the left. This doesn’t leave you much room to move things around later on.</p>
<p>One of the major advantages of CSS is the ability to separate styles from content. You can totally redesign your site by just modifying the CSS without ever touching the HTML. So <strong>don’t muck up your CSS by using limiting names</strong>. Use more versatile naming conventions and stay consistent.</p>
<p>Leave position or style specific words out of your styles and id’s. A class of .link-blue will either make more work for you, or make your style sheet really messy when your client later asks you to change those blue links to orange.</p>
<p><strong>Name your elements based on what they are, not what they look like.</strong> For example, .comment-blue is much less versatile than .comment-beta, and .post-largefont is more limiting than .post-title.</p>
<p>With these three simple suggestions in mind, not only will you write better looking CSS, but you&#8217;ll communicate your intentions to coworkers more clearly and you won&#8217;t be lost when it comes to a future updates. Enjoy and happy coding!</p>
<p><strong>Bonus: </strong>Here are <a href="http://www.hongkiat.com/blog/20-useful-css-tips-for-beginners/" target="_blank">20 more useful CSS tips</a> from <a href="http://www.hongkiat.com/" target="_blank">HONGKIAT.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://jaredlewandowski.com/blog/2009/10/writing-good-css/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using @import in CSS</title>
		<link>http://jaredlewandowski.com/blog/2009/04/using-import-in-css/</link>
		<comments>http://jaredlewandowski.com/blog/2009/04/using-import-in-css/#comments</comments>
		<pubDate>Thu, 23 Apr 2009 16:03:49 +0000</pubDate>
		<dc:creator>Jared Lewandowski</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[css]]></category>

		<guid isPermaLink="false">http://jaredlewandowski.com/blog/?p=267</guid>
		<description><![CDATA[I&#8217;ve been using CSS quite frequently over the last few years to design my web pages. In the process of using it, I have come across some very useful features that have made my design strategy and develop phases much more enjoyable. At the top of the list is the @import rule. This rule allows [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using CSS quite frequently over the last few years to design my web pages. In the process of using it, I have come across some very useful features that have made my design strategy and develop phases much more enjoyable. At the top of the list is the @import rule. This rule allows you to include external style sheets in your document. It is a way of creating a style sheet within your document, and then importing additional rules into the document.</p>
<p>To use the @import rule, type:</p>
<pre class="brush: css; title: ;">&lt;style type=&quot;text/css&quot;&gt;
 @import url(&quot;import1.css&quot;);
 @import url &quot;import2.css&quot;;
 &lt;/style&gt;</pre>
<p>The url() is not required. The double quotes are required for valid XHTML, but browsers that support url() tend to support it with or without quotes.</p>
<p>You can also include an @import rule in a style sheet with styles:</p>
<pre class="brush: css; title: ;">&lt;style type=&quot;text/css&quot;&gt;
 @import url(&quot;import3.css&quot;);
 p { color : #f00; }
 &lt;/style&gt;</pre>
<p><strong>@import rules must always be first in a document</strong></p>
<p>Finally, you can also import a style sheet for just a specific media:</p>
<pre class="brush: css; title: ;">&lt;style type=&quot;text/css&quot;&gt;
 @import url(&quot;import4.css&quot;) tv, print;
 &lt;/style&gt;</pre>
<p>This acts the same as if you had defined the media type in the &lt;style&gt; tag.</p>
<p><strong>Browser Support</strong><br />
Netscape 4.x and IE 3.x do not support the @import rule. Internet Explorer 6 and below do not support the media designation. IE 4.x has some support for the @import rule, but it&#8217;s spotty, and it&#8217;s best not to rely on it.</p>
]]></content:encoded>
			<wfw:commentRss>http://jaredlewandowski.com/blog/2009/04/using-import-in-css/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

