<?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>carbon 13 &#124; cthirteen.com &#187; Layout</title>
	<atom:link href="http://cthirteen.com/category/layout/feed" rel="self" type="application/rss+xml" />
	<link>http://cthirteen.com</link>
	<description>Design Patterns and Coding for the Web</description>
	<lastBuildDate>Sun, 09 May 2010 22:20:48 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Grids and The Box Model</title>
		<link>http://cthirteen.com/layout/grids-and-the-box-model</link>
		<comments>http://cthirteen.com/layout/grids-and-the-box-model#comments</comments>
		<pubDate>Sun, 09 May 2010 22:05:21 +0000</pubDate>
		<dc:creator>Matthew</dc:creator>
				<category><![CDATA[Layout]]></category>
		<category><![CDATA[Box Model]]></category>
		<category><![CDATA[Grids]]></category>

		<guid isPermaLink="false">http://cthirteen.com/?p=39</guid>
		<description><![CDATA[This is my first official post on Carbon 13. It is only courteous that I introduce myself &#8211; my name is Matthew and if you are reading this you might be the first.
I&#8217;d like to start off by talking about web page layout because it is one of the foundations of building a good website. [...]]]></description>
			<content:encoded><![CDATA[<p>This is my first official post on Carbon 13. It is only courteous that I introduce myself &#8211; my name is Matthew and if you are reading this you might be the first.</p>
<p>I&#8217;d like to start off by talking about web page layout because it is one of the foundations of building a good website. This involves talking a little bit about grids and the CSS box model.</p>
<h2>Grids</h2>
<p>Ill leave the brief definition to <a href="http://en.wikipedia.org/wiki/Grid_%28page_layout%29">Wikipedia</a>:</p>
<blockquote><p>A typographic grid is a two-dimensional structure made up of a series of intersecting vertical and horizontal axes used to structure content. The grid serves as an armature on which a designer can organize text and images in a rational, easy to absorb manner.</p></blockquote>
<p><div id="attachment_55" class="wp-caption alignright" style="width: 310px"><a href="http://cthirteen.com/wp-content/uploads/2010/03/grid.png"><img src="http://cthirteen.com/wp-content/uploads/2010/03/grid-300x269.png" alt="" title="grid" width="300" height="269" class="size-medium wp-image-55" /></a><p class="wp-caption-text">Figure 1: Carbon13's Grid Layout</p></div>To the right is a block style mock up of Carbon13&#8217;s main page that I made in Adobe Phototshop. After doing some brainstorming on paper, Photoshop or another graphics program (like <a href="http://www.gimp.org">Gimp</a> for Linux &#8211; which is free) are great places to start for a page layout. Photoshop &#8216;Guides&#8217; which can be overlaid on a document (View >> New Guide) are an important tool to help you build your grid.</p>
<p>Though your design is meant to change and grow, it is important to make a few decisions on where you want to start. One of these first decisions is whether you want to have a fixed or fluid width website. If the site is a blog, or a website where there is content that is meant to be read, I recommend a fixed width layout. This is because studies show that there is an <a href="http://www.maxdesign.com.au/articles/em/">ideal column width</a> of about 12 words and that reading rate slows and retention decreases as you make the lines longer. I think that 12 is a little on the conservative side, but do recommend that there shouldn&#8217;t be too many more than 20 words per line.</p>
<p>Using Carbon13 as an example, I have a fixed width two column layout with a 600px content and 300px sidebar for sponsors, featured posts, and other links. There is also a consistent spacing between grid elements which is referred to as a gutter. Carbon 13 features 20px gutters that separate blocks of content . Gutters can not only separate boxes of content but serve as padding for the text or objects nested inside a block. In the binding of a book, <a href="http://desktoppub.about.com/cs/pagelayout/g/gutter.htm">gutters</a> are the extra space allowed in the center of the book while space between columns are called alleys. More modern definitions refer to both grid spacings (gutters and alleys) as gutters. I find that using one gutter width helps to bring a feeling of consistency and professionalism to a sites look.</p>
<h2>The CSS Box Model</h2>
<p><div id="attachment_69" class="wp-caption alignleft" style="width: 310px"><a href="http://cthirteen.com/wp-content/uploads/2010/03/box_model.jpg"><img src="http://cthirteen.com/wp-content/uploads/2010/03/box_model.jpg" alt="" title="box_model" width="300" height="300" class="size-full wp-image-69" /></a><p class="wp-caption-text">Figure 2: The CSS Box Model</p></div> Transforming a grid layout that you have designed in a graphics program or on paper to HTML and CSS requires an understanding of the CSS box model. The image here to the left is a depiction of how the CSS box model works. When I first started coding CSS it took me a while to get a hold of how this worked and I often had ran into trouble because I didn&#8217;t know what the &#8216;true width&#8217; (&#8216;true height&#8217;) of a box element. Margins should be used to create gutters between box elements, while padding should be used position text or images inside of box. The &#8216;true width&#8217; of a box then is the border-left + border-right + padding-left + padding-right + width (similarly the &#8216;true-height&#8217; is the border-top + border-bottom + padding-top + padding-bottom + height). To help clarify further lets look at some example code. Say I created a div with the HTML and CSS below:</p>
<pre>
<div class="codesnip-container" >
<div class="css codesnip" style="font-family:monospace;"><span class="coMULTI">/* The CSS */</span>

<span class="re0">#aBox</span>
<span class="br0">&#123;</span>
&nbsp; &nbsp;<span class="kw1">width</span><span class="sy0">:</span> <span class="re3">100px</span><span class="sy0">;</span>
&nbsp; &nbsp;<span class="kw1">height</span><span class="sy0">:</span> <span class="re3">40px</span><span class="sy0">;</span>
&nbsp; &nbsp;<span class="kw1">border</span><span class="sy0">:</span> <span class="re3">5px</span> <span class="kw2">solid</span> <span class="re0">#3D9436</span><span class="sy0">;</span>
&nbsp; &nbsp;<span class="kw1">padding</span><span class="sy0">:</span> <span class="re3">25px</span> <span class="re3">10px</span> <span class="re3">0px</span> <span class="re3">40px</span><span class="sy0">;</span>
&nbsp; &nbsp;<span class="kw1">background</span><span class="sy0">:</span> <span class="re0">#A4E84A</span><span class="sy0">;</span>
<span class="br0">&#125;</span></div>
</div>
<div class="codesnip-container" >
<div class="html4strict codesnip" style="font-family:monospace;"><span class="sc-1">&lt;!-- The HTML --&gt;</span>

<span class="sc2">&lt;<a href="http://december.com/html/4/element/div.html"><span class="kw2">div</span></a> <span class="kw3">id</span> <span class="sy0">=</span><span class="st0">&quot;aBox&quot;</span>&gt;</span>
Hello World!
<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/div.html"><span class="kw2">div</span></a>&gt;</span></div>
</div>
</pre>
<p>Would look like this:</p>
<div style="width: 100px; height: 40px; border: 5px solid #3D9436; padding: 25px 10px 0px 40px; background: #A4E84A; margin-bottom:20px;">Hello World!</div>
<p>
<strong><em>Try these tools out! Will write a post about Firebug soon.</em></strong></p>
<p></p>
<h2>Tools:</h2>
<ul>
<li>Firebug &#8211; take a dive into your CSS and HTML with this extension for <a href="http://getfirebug.com/downloads">Firefox</a> and <a href="http://getfirebug.com/releases/lite/chrome/">Chrome</a></li>
<li><a href="http://www.designinfluences.com/fluid960gs/">Fluid 960</a> and the <a href="http://960.gs/">960  Grid System</a></li>
<li><a href="http://www.gimp.org">Gimp</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://cthirteen.com/layout/grids-and-the-box-model/feed</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
	</channel>
</rss>

