<?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>Bloggerrific &#187; css template</title>
	<atom:link href="http://www.davidjrush.com/blog/tag/css-template/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.davidjrush.com</link>
	<description>David J. Rush is a web designer and usability consultant in Pittsburgh who freelances and blogs about anything web related.</description>
	<lastBuildDate>Thu, 05 Jan 2012 02:50:29 +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>Setting Up Your First External CSS File</title>
		<link>http://www.davidjrush.com/blog/2008/12/setting-up-your-first-external-css-file/</link>
		<comments>http://www.davidjrush.com/blog/2008/12/setting-up-your-first-external-css-file/#comments</comments>
		<pubDate>Sun, 28 Dec 2008 13:25:00 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[CSS Tutorials and Tricks]]></category>
		<category><![CDATA[css basics]]></category>
		<category><![CDATA[css template]]></category>
		<category><![CDATA[external css]]></category>

		<guid isPermaLink="false">http://www.davidjrush.com/blog/?p=8</guid>
		<description><![CDATA[In a recent post, CSS &#8211; Back To Basics, I discussed the purpose of CSS and how to use tags, classes, and IDs to create style definitions. This time around, I&#8217;ll chat about setting up an external CSS file and giving it some basic definitions that you should always include in your main CSS file. [...]]]></description>
			<content:encoded><![CDATA[<p>In a recent post, <a href="http://www.davidjrush.com/blog/2008/12/css-back-to-basics/">CSS &#8211; Back To Basics</a>, I discussed the purpose of CSS and how to use tags, classes, and IDs to create style definitions. This time around, I&#8217;ll chat about setting up an external CSS file and giving it some basic definitions that you should <span style="font-style: italic;">always</span> include in your main CSS file.</p>
<p>So first, let&#8217;s explain how to make an external CSS file. The purpose in doing this is to keep all your CSS in a separate place from your HTML. But why is that important? Well, for one, it will speed up the load time of your page for your users. Probably infinitely more important is that it is much more likely that most of the CSS you write for one of your documents will apply to another one. Why repeat it in the head of every page if you can just write it once? That way, when you need to make changes, it&#8217;ll be much easier.</p>
<p>Alright, so here is how you make a reference to an external CSS file. In your head section, put the following line of code:</p>
<pre class="brush: xml; title: ; notranslate">&lt;link href=&quot;main.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; /&gt;</pre>
<p>You can replace <span style="font-style: italic;">main.css</span> with whatever you want to name your CSS document. Main is a good idea if you plan on having multiple CSS files (for large sites). For smaller sites, you probably only need one (for example, my website, <a href="http://www.davidjrush.com/">www.davidjrush.com</a>, has only one external CSS file (actually, technically it has two, one for the blog, and one for the rest).</p>
<p>You can make your new CSS file (for now, we&#8217;ll just assume you are calling it main.css) in a text writer. Change the file extension from .txt to .css just like you would change .txt to .html for an HTML file. Inside the document, you don&#8217;t need any tags, in fact, you shouldn&#8217;t have any! All you should write in this document is the style that you would have put in the head (but without the &lt;style&gt; tag).</p>
<p>Now I&#8217;ll discuss some basics of what you should have in every main CSS file you ever write for a website. There are somewhere around <a href="http://www.w3schools.com/tags/default.asp" target="_blank">80 tags for HTML</a>, but only about 30 of them are commonly used. Of these 30 you should think about defining these basic tags: <span style="font-weight: bold;">body, div, img, table, p, ul, a, and a:hover</span>. The reasoning behind this is safety safety safety! Different browsers have different default settings for some of these tags. So the smart move is to give them all uniform settings from the start.</p>
<p>You may want to start your main CSS document with the following:</p>
<pre class="brush: css; title: ; notranslate">
/*--this is a comment, you can put anything inside the star and slash--*/
body{
   margin: 0px;
   padding: 0px;
}
div{
   margin: 0px;
   padding: 0px;
}
img{
   border: 0px;
   margin: 0px;
   padding: 0px;
}
table{
   margin: 0px;
   padding: 0px;
}
p{
   margin: 15px;
   padding: 0px;
}
ul{
   margin-top: 10px;
   margin-bottom: 10px;
   margin-left: 35px;
   padding: 0px;
   list-style-image: url('image location');
   line-height: 20px; (gives spacing between list items)
}
a{
   text-decoration: underline/none;
   color: hexcode/word;
   font-weight: bold/normal;
}
a:hover{
   text-decoration: underline/none;
   color: hexcode/word;
   font-weight: bold/normal;
   /*make sure to change at least one thing from your a tag definition*/
}
a:visited{
   text-decoration: underline/none;
   color: hexcode/word;
   font-weight: bold/normal;
   /*make sure to change at least one thing from your a tag definition*/
}</pre>
<p>Anything in red is just a comment to help you out. The first several definitions really just look at margin and padding. This is where cross browser compatibility comes into play. For example, Internet Explorer and Firefox have different default settings for margin on p tags. This will cause pages to render differently. It always seems like a safe bet to define your margin and padding for most anything. In an upcoming post, I&#8217;ll discuss <a href="http://www.davidjrush.com/blog/2008/12/css-controlling-copy-aka-text/">defining your copy/text</a> (which will include more specific information on p tags, a tags, and other similar issues.</p>
<p>You&#8217;ll notice in the links section, there is a definition for an a tag, an a tag being hovered on by the mouse, and an a tag that has been visited by the user. The latter two are called &#8220;pseudo-classes&#8221;. There are others, and they can be applied to tags other than the a tag, just so you know.</p>
<p>If you have any questions about this starter file, post a comment, or send me an email. Stay tuned for further CSS related posts.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.davidjrush.com/blog/2008/12/setting-up-your-first-external-css-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

