<?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>Knowledge Reactor&#039;s Blog &#187; css</title>
	<atom:link href="http://blog.knowledge-reactor.com/tag/css/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.knowledge-reactor.com</link>
	<description>by Gordon Cindric</description>
	<lastBuildDate>Sun, 11 Apr 2010 18:29:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>CSS For Absolute Beginners</title>
		<link>http://blog.knowledge-reactor.com/2009/11/css-for-absolute-beginners/</link>
		<comments>http://blog.knowledge-reactor.com/2009/11/css-for-absolute-beginners/#comments</comments>
		<pubDate>Thu, 12 Nov 2009 23:02:56 +0000</pubDate>
		<dc:creator>Gordon</dc:creator>
				<category><![CDATA[Web Design]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[html]]></category>

		<guid isPermaLink="false">http://blog.knowledge-reactor.com/?p=238</guid>
		<description><![CDATA[The Cascading Style Sheet language is the most commonly used language in web design and online application styling. No matter which language you choose as your programming platform, you will (or at least should) always end up combining it with CSS. With CSS you can move around elements of your website, align them, overlap them, [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p><!-- google_ad_section_start --><img class="alignleft size-full wp-image-209" title="CSS For Absolute Beginners" src="http://blog.knowledge-reactor.com/wp-content/uploads/2009/11/css_img.png" alt="CSS For Absolute Beginners" width="110" height="110" />The Cascading Style Sheet language is the most commonly used language in web design and online application styling. No matter which language you choose as your programming platform, you will (or at least should) always end up combining it with CSS.</p>
<p><span id="more-238"></span></p>
<p>With CSS you can move around elements of your website, align them, overlap them, color them, resize them and many other interesting design tricks.</p>
<p>Being a long way from a CSS expert myself, I will try to explain the very core of CSS in a simple and intuitive way &#8211; in which I wish it was explained to me.</p>
<h2><strong>The Supervisor and the Worker</strong></h2>
<p><img class="alignright size-full wp-image-254" title="You and CSS on your website" src="http://blog.knowledge-reactor.com/wp-content/uploads/2009/11/csswarehouse_illustration.gif" alt="You and CSS on your website" width="250" height="234" /></p>
<p>In the web design world, imagine that your website is a warehouse.   You are the warehouse supervisor and CSS is the worker. In this relationship, the HTML code would have the function of all the boxes in your warehouse representing various web elements (such as header, footer, navigation, subscribe to e-mail box, twitter feed box, etc). You shout your instructions to your worker using CSS code.</p>
<h2>The Bare Basics</h2>
<p>To fully understand this post you should have a basic understanding of HTML. So let&#8217;s get started. The first line of code that you learn when you want to work with CSS is:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p238code7'); return false;">View Code</a> HTML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2387"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p238code7"><pre class="html" style="font-family:monospace;">&lt;link rel=&quot;stylesheet&quot; href=&quot;styles.css&quot; type=&quot;text/css&quot; /&gt;</pre></td></tr></table></div>

<p>This snippet of code (which you are supposed to put between the head tags of your website HTML file) tells the browser where to look for the style sheet. You don&#8217;t have to use the name styles.css although it&#8217;s the most common. If your CSS file is located in a sub-folder on the server, you can write the entire path.</p>
<p>You can experiment with this by opening a new folder on your desktop (or anywhere you want) and creating an <strong>index.html</strong> and <strong>styles.css</strong> files. The styles.css can be empty for now but you can copy the following code snippet into your html file:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p238code8'); return false;">View Code</a> HTML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2388"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code" id="p238code8"><pre class="html" style="font-family:monospace;">&lt;html&gt;
&lt;head&gt;
&lt;link rel=&quot;stylesheet&quot; href=&quot;styles.css&quot; type=&quot;text/css&quot; /&gt;
&lt;/head&gt;
&lt;body&gt;
My website elements go here!
&lt;/body&gt;
&lt;/html&gt;</pre></td></tr></table></div>

<p>Now we have defined a basic HTML file. We have our opening html tag, the opening head tag, we have defined the browser window title of our website, we have told the browser where to look for the CSS style sheet, closed the head, wrote a simple line of text in the body and closed our html tags.</p>
<h2>Telling your &#8220;Worker&#8221; which &#8220;Boxes&#8221; to move around</h2>
<p>If we want to get the job done, we need to explain what we want to our employee. In other words, write some CSS code. Will our employee understand if we tell him to move the brown box and all boxes in the warehouse are brown? We have to find some sort of method to label the boxes so that our CSS script understands what to manipulate.</p>
<p>This labeling is done with <strong>div</strong> tags.</p>
<p>Remember how you heard someone telling you that table-layout website design using MS Front Page was old and nobody should use it anymore? The idea was that tables should be replaced by divs where each div had a unique ID. That way, you basically, labeled the boxes. Here is an example:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p238code9'); return false;">View Code</a> HTML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2389"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code" id="p238code9"><pre class="html" style="font-family:monospace;">&lt;html&gt;
&lt;head&gt;
&lt;link rel=&quot;stylesheet&quot; href=&quot;styles.css&quot; type=&quot;text/css&quot; /&gt;
&lt;/head&gt;
&nbsp;
&lt;body&gt;
&lt;div id=&quot;text1&quot;&gt;My website elements go here!&lt;/div&gt;
&lt;/body&gt;
&nbsp;
&lt;/html&gt;</pre></td></tr></table></div>

<p>Notice what I added between the body tag, in front and behind of the &#8220;My website elements go here!&#8221;? We&#8217;ve put the text located in the body of the website into a div with an ID of &#8220;text1&#8243;. A DIV is an invisible box which wraps around the content defined between it&#8217;s tags. This method will allow us to manipulate it from the CSS file. We gave our box a label for our employee to recognize it.</p>
<p>Now open your styles.css in a text editor and update it with:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p238code10'); return false;">View Code</a> CSS</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p23810"><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code" id="p238code10"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#text1</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">green</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">50px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

<p>Here we have specified that we want to manipulate the text1 div box and assign it a green background color. Also we want all the text in that box to have a size of 50 pixels. Save your css file and refresh the web page in the browser. You should see the results.</p>
<p>Now lets try adding another empty div box to our websites HTML code:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p238code11'); return false;">View Code</a> HTML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p23811"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code" id="p238code11"><pre class="html" style="font-family:monospace;">&lt;html&gt;
&lt;head&gt;
&lt;link rel=&quot;stylesheet&quot; href=&quot;styles.css&quot; type=&quot;text/css&quot; /&gt;
&lt;/head&gt;
&nbsp;
&lt;body&gt;
&lt;div id=&quot;text1&quot;&gt;My website elements go here!&lt;/div&gt;
&lt;div id=&quot;box2&quot;&gt;&lt;/div&gt;
&lt;/body&gt;
&nbsp;
&lt;/html&gt;</pre></td></tr></table></div>

<p>Also, let&#8217;s add some parameters for the box2 div in our css file:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p238code12'); return false;">View Code</a> CSS</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p23812"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code" id="p238code12"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#text1</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">green</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">50px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#box2</span> <span style="color: #00AA00;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">;</span>
        <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">200px</span><span style="color: #00AA00;">;</span>
        <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">green</span><span style="color: #00AA00;">;</span>
        <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span> <span style="color: #993333;">solid</span> <span style="color: #000000; font-weight: bold;">black</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

<p>You probably noticed how I gave our box2 div a defined width and height. This is because it is empty and if you didn&#8217;t specify its dimensions it would just be a flat line like a blown out balloon. We also gave the box a background color of green (you can also write #HEX color value instead of the actual name) and we defined the border property of 5 pixels, solid and a color of black. Refresh and observe the results. Try changing the &#8220;solid&#8221; value to &#8220;dashed&#8221; and see what happens.</p>
<h2>Conclusion</h2>
<p>Hopefully this brief tutorial was useful for you and helped you understand the very basics of CSS. This was of course just a small fragment of the vast usability that CSS possess.</p>
<p>If you wish to continue further development of your CSS skills, I recommend <a href="http://www.w3schools.com/css/default.asp" target="_blank">W3Schools CSS tutorial</a>. As far as software goes, I would suggest <a href="http://notepad-plus.sourceforge.net/uk/site.htm" target="_blank">Notepad++</a> as something you should have installed right after your OS.</p>
<p>Once you realize that it&#8217;s all about labeling boxes and moving them around, it just comes down to learning all the thousands of properties that exist in the language itself.</p>
<p>Here are some examples of properties which I use the most:</p>
<ul>
<li>background-image</li>
<li>margins</li>
<li>padding</li>
<li>text-weight</li>
<li>height</li>
<li>width</li>
<li>float</li>
<li>text-align</li>
<li>vertical-align</li>
</ul>
<p>At the bottom you can find the download link where you can get the index.html and the styles.css used in this post. Also stay tuned via Twitter, where I will be posting updates for the various web design video tutorials (for beginners) that will soon be published on the Knowledge Reactor website.</p>
<p>Finally, I would like to thank my good friend and great artist <strong>Marino Plecas</strong> for the forklift illustration!</p>
<p><a href="http://blog.knowledge-reactor.com/wp-content/uploads/2009/11/CSSforbeginners_KRblog.zip">DOWNLOAD</a><!-- google_ad_section_end -->
<div class="tweetmeme_button" style="float: right; margin-left: 10px; margin-bottom:10px; margin-top: 0px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.knowledge-reactor.com%2F2009%2F11%2Fcss-for-absolute-beginners%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.knowledge-reactor.com%2F2009%2F11%2Fcss-for-absolute-beginners%2F&amp;source=McKnightikus&amp;style=compact&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
     

<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.knowledge-reactor.com/2009/11/css-for-absolute-beginners/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
