<?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>Learning Is Fun &#187; Web Design</title>
	<atom:link href="http://www.tanzilo.com/category/web-design/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tanzilo.com</link>
	<description>Talks on Web Technology and Better Product Development</description>
	<lastBuildDate>Sat, 29 Jan 2011 22:03:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Tableless Web Design in CSS: 2 &amp; 3 columns with Header &amp; Footer</title>
		<link>http://www.tanzilo.com/2008/10/24/tableless-web-design-in-css-2-3-columns-with-header-footer/</link>
		<comments>http://www.tanzilo.com/2008/10/24/tableless-web-design-in-css-2-3-columns-with-header-footer/#comments</comments>
		<pubDate>Fri, 24 Oct 2008 09:14:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[2 columns]]></category>
		<category><![CDATA[3 columns]]></category>
		<category><![CDATA[Footer]]></category>
		<category><![CDATA[Header]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Tableless]]></category>
		<category><![CDATA[Tableless Footer]]></category>
		<category><![CDATA[Tableless Header]]></category>
		<category><![CDATA[three columns]]></category>
		<category><![CDATA[two columns]]></category>
		<category><![CDATA[Website Design]]></category>

		<guid isPermaLink="false">http://www.tanzilo.com/?p=6</guid>
		<description><![CDATA[Hello Folks, You know the web design has already transferred from the table based design to tableless design. This does not you will never use tables. What it means that using table in building website structure is getting rare. But why do people go for tableless design? Although there are many reasons, the most important [...]]]></description>
			<content:encoded><![CDATA[<p>Hello Folks,</p>
<p>You know the web design has already transferred from the table based design to tableless design. This does not you will never use tables. What it means that using table in building website structure is getting rare. But why do people go for tableless design? Although there are many reasons, the most important reason is you save a lots of bandwidth by coding cleaner and fewer lines. Tableless web design is fun too!</p>
<p>But I must admit that <span style="text-decoration: underline;">it is a very easy tutorial for anyone</span>. My target audience is those who are new to website design and wish to start designing in tableless format.</p>
<p>If you do not understand the whole article at the first time, my suggestion is you read it again.</p>
<p>OK. Let us start. Here we go:</p>
<h1>2 Column tableless page design</h1>
<p><strong>Step One: A 2 column complete page coding</strong></p>
<p>First take a look at the page code below. You can see the output here: <a title="2 Column Tableless Web Design" href="http://www.tanzilo.com/demo/code/tableless/column2.php" target="_blank">2 Column Page Output</a></p>
<p>I suggest you go to <a title="2 Column Tableless Web Design" href="http://www.tanzilo.com/demo/code/tableless/column2.php" target="_blank">this output page</a>, open the source code and take a look for a better indent view.</p>
<p><span style="color: #800000;">&lt;!DOCTYPE html PUBLIC &#8220;-//W3C//DTD XHTML 1.0 Transitional//EN&#8221; &#8220;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#8221;&gt;<br />
&lt;html xmlns=&#8221;http://www.w3.org/1999/xhtml&#8221;&gt;<br />
&lt;head&gt;<br />
&lt;meta http-equiv=&#8221;Content-Type&#8221; content=&#8221;text/html; charset=utf-8&#8243; /&gt;<br />
&lt;title&gt;2 Column CSS Example&lt;/title&gt;<br />
&lt;style type=&#8221;text/css&#8221;&gt;</span></p>
<p><span style="color: #800000;">BODY<br />
{<br />
margin:0px; padding:0px; text-align:center;<br />
font-family:Arial, Helvetica, sans-serif; font-size:12px;<br />
}<br />
P<br />
{<br />
margin:0px; padding:17px 0px 0px 0px;<br />
color:#CCCCCC;<br />
}<br />
H1<br />
{<br />
margin:0px; padding:25px 0px 0px 0px;<br />
font-family:Arial, Helvetica, sans-serif; font-size:20px;<br />
color:#FFFFFF;<br />
}<br />
UL<br />
{<br />
margin:0px; padding:0px;<br />
}<br />
LI<br />
{<br />
list-style:none; padding:5px 0px 0px 20px;<br />
}<br />
LI A<br />
{<br />
color:#CCCCCC; text-decoration:none;<br />
}<br />
LI A:hover<br />
{<br />
color:#FFFFFF; text-decoration:underline;<br />
}<br />
#pageText<br />
{<br />
padding:15px 0px 0px 20px;<br />
}<br />
#container<br />
{<br />
width:775px; margin:0 auto;<br />
}<br />
#header<br />
{<br />
width:100%; height:100px; background:#990000;<br />
}<br />
#content<br />
{<br />
clear:both;<br />
}<br />
#leftColumn<br />
{<br />
width:275px; height:300px; background:#000000;<br />
text-align:left;<br />
float:left;<br />
}<br />
#rightColumn<br />
{<br />
width:500px; height:300px; background:#003300;<br />
text-align:left; color:#CCCCCC;<br />
float:left;<br />
}<br />
#footer<br />
{<br />
width:100%; height:50px; background:#330033;<br />
clear:both;<br />
}</span></p>
<p><span style="color: #800000;">&lt;/style&gt;<br />
&lt;/head&gt;</span></p>
<p><span style="color: #800000;">&lt;body&gt;</span></p>
<p><span style="color: #800000;">&lt;!&#8211; CONTAINER starts here &#8211;&gt;<br />
&lt;div id=&#8221;container&#8221;&gt;</span></p>
<p><span style="color: #800000;">&lt;!&#8211; HEADER starts here &#8211;&gt;<br />
&lt;div id=&#8221;header&#8221;&gt;<br />
&lt;h1&gt;2 Column CSS Example&lt;/h1&gt;<br />
&lt;p&gt;Sub Title&lt;/p&gt;<br />
&lt;/div&gt;<br />
&lt;!&#8211; HEADER ends here &#8211;&gt;</span></p>
<p><span style="color: #800000;">&lt;!&#8211; PAGE CONTENT starts here &#8211;&gt;<br />
&lt;div id=&#8221;content&#8221;&gt;</span></p>
<p><span style="color: #800000;">&lt;!&#8211; LEFT COLUMN starts here &#8211;&gt;<br />
&lt;div id=&#8221;leftColumn&#8221;&gt;</span></p>
<p><span style="color: #800000;">&lt;!&#8211; LEFT MENU starts here &#8211;&gt;<br />
&lt;ul&gt;<br />
&lt;li&gt;&lt;a href=&#8221;#&#8221;&gt;This is the first navigation link&lt;/a&gt;&lt;/li&gt;<br />
&lt;li&gt;&lt;a href=&#8221;#&#8221;&gt;This is the second navigation link&lt;/a&gt;&lt;/li&gt;<br />
&lt;li&gt;&lt;a href=&#8221;#&#8221;&gt;This is the third navigation link&lt;/a&gt;&lt;/li&gt;<br />
&lt;li&gt;&lt;a href=&#8221;#&#8221;&gt;This is the fourth navigation link&lt;/a&gt;&lt;/li&gt;<br />
&lt;li&gt;&lt;a href=&#8221;#&#8221;&gt;This is the fifth navigation link&lt;/a&gt;&lt;/li&gt;<br />
&lt;/ul&gt;<br />
&lt;!&#8211; LEFT MENU ends here &#8211;&gt;</span></p>
<p><span style="color: #800000;">&lt;/div&gt;<br />
&lt;!&#8211; LEFT COLUMN ends here &#8211;&gt;</span></p>
<p><span style="color: #800000;">&lt;!&#8211; RIGHT COLUMN starts here &#8211;&gt;<br />
&lt;div id=&#8221;rightColumn&#8221;&gt;<br />
&lt;div id=&#8221;pageText&#8221;&gt;Your page content goes here.&lt;/div&gt;<br />
&lt;/div&gt;<br />
&lt;!&#8211; RIGHT COLUMN ends here &#8211;&gt;</span></p>
<p><span style="color: #800000;">&lt;/div&gt;<br />
&lt;!&#8211; PAGE CONTENT ends here &#8211;&gt;</span></p>
<p><span style="color: #800000;">&lt;!&#8211; FOOTER starts here &#8211;&gt;<br />
&lt;div id=&#8221;footer&#8221;&gt;<br />
&lt;p&gt;Copyright © 2008. Tanzilo Insido PHPo MySQLo&lt;/p&gt;<br />
&lt;/div&gt;<br />
&lt;!&#8211; FOOTER ends here &#8211;&gt;</span></p>
<p><span style="color: #800000;">&lt;/div&gt;<br />
&lt;!&#8211; CONTAINER starts here &#8211;&gt;</span></p>
<p><span style="color: #800000;">&lt;/body&gt;<br />
&lt;/html&gt;</span></p>
<p>In the following steps, I am going to clarify what I have done and how.</p>
<p><span style="text-decoration: underline;"><strong>Step One: The CONTAINER div is holding the whole page content</strong></span></p>
<p>First of all, please note that we have kept all our content elements inside a container DIV element:</p>
<p><span style="color: #800000;">&lt;div id=&#8221;container&#8221;&gt;<br />
&lt;/div&gt;</span></p>
<p>And here is the CSS for this section:</p>
<p><span style="color: #800000;">#container<br />
{<br />
width:775px; margin:0 auto;<br />
}</span></p>
<p>Notice that this is a fixed width design of 775 pixels and the part <span style="text-decoration: underline;"><span style="color: #800000;">margin:0 auto;</span></span> sets the content area in the page center alignment.</p>
<p><span style="text-decoration: underline;"><strong>Step Two: The HEADER AND FOOTER</strong></span></p>
<p>Now we have three main areas inside our container div and there they are:</p>
<p><span style="color: #800000;">&lt;div id=&#8221;header&#8221;&gt;&lt;/div&gt;<br />
&lt;div id=&#8221;content&#8221;&gt;&lt;/div&gt;<br />
&lt;div id=&#8221;footer&#8221;&gt;&lt;/div&gt;</span></p>
<p>In the <span style="text-decoration: underline;">header</span> div section, we only put a two line text and in the <span style="text-decoration: underline;">footer</span> div section, we put just the copyright information.</p>
<p>Here is the CSS for <span style="text-decoration: underline;">header</span> div:</p>
<p><span style="color: #800000;">#header<br />
{<br />
width:100%; height:100px; background:#990000;<br />
}</span></p>
<p>Note that we are clearly specifying the width and height of the header section. Sometimes you may find that this section is not appearing. It may happen if you do not mention the values for height and/or width clearly.</p>
<p>And here is the CSS for <span style="text-decoration: underline;">footer</span> div:</p>
<p><span style="color: #800000;">#footer<br />
{<br />
width:100%; height:50px; background:#330033;<br />
clear:both;<br />
}</span></p>
<p>We clearly specified the values for height and width again. But specially notice the <span style="text-decoration: underline;"><span style="color: #800000;">clear:both;</span></span> part. Why do we write this line? Because we are using floating feature. When we use <span style="text-decoration: underline;"><span style="color: #800000;">clear:both;</span></span>for a div area, it floats left by default and does not mess up with any other div area.</p>
<p>Simple. Huh?</p>
<p><span style="text-decoration: underline;"><strong>Step Three: The CONTENT div</strong></span></p>
<p>We have put our two columns in the <span style="text-decoration: underline;">content</span> div:</p>
<p><span style="color: #800000;">&lt;div id=&#8221;content&#8221;&gt;&lt;/div&gt;</span></p>
<p>And here is the CSS for <span style="text-decoration: underline;">content</span> div:</p>
<p><span style="color: #800000;">#content<br />
{<br />
clear:both;<br />
}</span></p>
<p>Notice that we are using <span style="text-decoration: underline;"><span style="color: #800000;">clear:both;</span></span> coding to avoid any mess up with the header. If you do not clear your div, it will automatically try to be positioned side by side with the preceeding div (provided it gets enough space there).</p>
<p><span style="text-decoration: underline;"><strong>Step Four: The two columns in the CONTENT div</strong></span></p>
<p>Inside our <span style="text-decoration: underline;">content</span> div element, we have two div element and those are <span style="text-decoration: underline;">leftColumn</span> div and <span style="text-decoration: underline;">rightColumn</span> div.</p>
<p><span style="color: #800000;">&lt;div id=&#8221;leftColumn&#8221;&gt;&lt;/div&gt;<br />
&lt;div id=&#8221;rightColumn&#8221;&gt;&lt;/div&gt;</span></p>
<p>Here is the CSS for leftColumn div:</p>
<p><span style="color: #800000;">#leftColumn<br />
{<br />
width:275px; height:300px; background:#000000;<br />
text-align:left;<br />
float:left;<br />
}</span></p>
<p>And here is the CSS for the rightColumn div:</p>
<p><span style="color: #800000;">#rightColumn<br />
{<br />
width:500px; height:300px; background:#003300;<br />
text-align:left; color:#CCCCCC;<br />
float:left;<br />
}</span></p>
<p>You specially need to notice the following two things</p>
<p>1. We are using float feature for <strong>both</strong> of them and floating <strong>both</strong> of them to left.<br />
2. Add the witdh of the leftColumn and rightColumn and that is 775 pixels (225 px + 500 px) that is exactly equal to the width of our <span style="text-decoration: underline;">container</span> div (775 px).</p>
<p>What I am trying to say is: when you float two DIVs to the same direction (i.e. left in our case), they take position side by side as like two columns. But the total width of both of them must be equal to or less than the width of the div they are positioned.</p>
<p><span style="text-decoration: underline;"><strong>Step five: Putting something in the left and right columns</strong></span></p>
<p>We assign some text in the left and right columns and thus we are done.</p>
<h1>3 Column tableless page design</h1>
<p><strong>Step One: A 3 column complete page coding</strong></p>
<p>First take a look at the page code below. You can see the output here: <a title="3 Column Tableless Web Design" href="http://www.tanzilo.com/demo/code/tableless/column3.php" target="_blank">3 Column Page Output</a></p>
<p>I suggest you go to <a title="3 Column Tableless Web Design" href="http://www.tanzilo.com/demo/code/tableless/column3.php" target="_blank">this output page</a>, open the source code and take a look for a better indent view.</p>
<p><span style="color: #800000;">&lt;!DOCTYPE html PUBLIC &#8220;-//W3C//DTD XHTML 1.0 Transitional//EN&#8221; &#8220;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#8221;&gt;<br />
&lt;html xmlns=&#8221;http://www.w3.org/1999/xhtml&#8221;&gt;<br />
&lt;head&gt;<br />
&lt;meta http-equiv=&#8221;Content-Type&#8221; content=&#8221;text/html; charset=utf-8&#8243; /&gt;<br />
&lt;title&gt;3 Column CSS Example&lt;/title&gt;<br />
&lt;style type=&#8221;text/css&#8221;&gt;</span></p>
<p><span style="color: #800000;">BODY<br />
{<br />
margin:0px; padding:0px; text-align:center;<br />
font-family:Arial, Helvetica, sans-serif; font-size:12px;<br />
}<br />
P<br />
{<br />
margin:0px; padding:17px 0px 0px 0px;<br />
color:#CCCCCC;<br />
}<br />
H1<br />
{<br />
margin:0px; padding:25px 0px 0px 0px;<br />
font-family:Arial, Helvetica, sans-serif; font-size:20px;<br />
color:#FFFFFF;<br />
}<br />
UL<br />
{<br />
margin:0px; padding:0px;<br />
}<br />
LI<br />
{<br />
list-style:none; padding:5px 0px 0px 20px;<br />
}<br />
LI A<br />
{<br />
color:#CCCCCC; text-decoration:none;<br />
}<br />
LI A:hover<br />
{<br />
color:#FFFFFF; text-decoration:underline;<br />
}<br />
#pageText<br />
{<br />
padding:15px 0px 0px 20px;<br />
}<br />
#container<br />
{<br />
width:775px; margin:0 auto;<br />
}<br />
#header<br />
{<br />
width:100%; height:100px; background:#990000;<br />
}<br />
#content<br />
{<br />
clear:both;<br />
}<br />
#leftColumn<br />
{<br />
width:200px; height:300px; background:#000000;<br />
text-align:left;<br />
float:left;<br />
}<br />
#middleColumn<br />
{<br />
width:375px; height:300px; background:#FFFFFF;<br />
text-align:left; color:#000000;<br />
float:left;<br />
}<br />
#rightColumn<br />
{<br />
width:200px; height:300px; background:#003300;<br />
text-align:left; color:#CCCCCC;<br />
float:left;<br />
}<br />
#footer<br />
{<br />
width:100%; height:50px; background:#330033;<br />
clear:both;<br />
}</span></p>
<p><span style="color: #800000;">&lt;/style&gt;<br />
&lt;/head&gt;</span></p>
<p><span style="color: #800000;">&lt;body&gt;</span></p>
<p><span style="color: #800000;">&lt;!&#8211; CONTAINER starts here &#8211;&gt;<br />
&lt;div id=&#8221;container&#8221;&gt;</span></p>
<p><span style="color: #800000;">&lt;!&#8211; HEADER starts here &#8211;&gt;<br />
&lt;div id=&#8221;header&#8221;&gt;<br />
&lt;h1&gt;3 Column CSS Example&lt;/h1&gt;<br />
&lt;p&gt;Sub Title&lt;/p&gt;<br />
&lt;/div&gt;<br />
&lt;!&#8211; HEADER ends here &#8211;&gt;</span></p>
<p><span style="color: #800000;">&lt;!&#8211; PAGE CONTENT starts here &#8211;&gt;<br />
&lt;div id=&#8221;content&#8221;&gt;</span></p>
<p><span style="color: #800000;">&lt;!&#8211; LEFT COLUMN starts here &#8211;&gt;<br />
&lt;div id=&#8221;leftColumn&#8221;&gt;</span></p>
<p><span style="color: #800000;">&lt;!&#8211; LEFT MENU starts here &#8211;&gt;<br />
&lt;ul&gt;<br />
&lt;li&gt;&lt;a href=&#8221;#&#8221;&gt;This is the first navigation link&lt;/a&gt;&lt;/li&gt;<br />
&lt;li&gt;&lt;a href=&#8221;#&#8221;&gt;This is the second navigation link&lt;/a&gt;&lt;/li&gt;<br />
&lt;li&gt;&lt;a href=&#8221;#&#8221;&gt;This is the third navigation link&lt;/a&gt;&lt;/li&gt;<br />
&lt;li&gt;&lt;a href=&#8221;#&#8221;&gt;This is the fourth navigation link&lt;/a&gt;&lt;/li&gt;<br />
&lt;li&gt;&lt;a href=&#8221;#&#8221;&gt;This is the fifth navigation link&lt;/a&gt;&lt;/li&gt;<br />
&lt;/ul&gt;<br />
&lt;!&#8211; LEFT MENU ends here &#8211;&gt;</span></p>
<p><span style="color: #800000;">&lt;/div&gt;<br />
&lt;!&#8211; LEFT COLUMN ends here &#8211;&gt;</span></p>
<p><span style="color: #800000;">&lt;!&#8211; MIDDLE COLUMN starts here &#8211;&gt;<br />
&lt;div id=&#8221;middleColumn&#8221;&gt;<br />
&lt;div id=&#8221;pageText&#8221;&gt;Your page content goes here.&lt;/div&gt;<br />
&lt;/div&gt;<br />
&lt;!&#8211; MIDDLE COLUMN ends here &#8211;&gt;</span></p>
<p><span style="color: #800000;">&lt;!&#8211; RIGHT COLUMN starts here &#8211;&gt;<br />
&lt;div id=&#8221;rightColumn&#8221;&gt;<br />
&lt;div id=&#8221;pageText&#8221;&gt;Your right column content goes here.&lt;/div&gt;<br />
&lt;/div&gt;<br />
&lt;!&#8211; RIGHT COLUMN ends here &#8211;&gt;</span></p>
<p><span style="color: #800000;">&lt;/div&gt;<br />
&lt;!&#8211; PAGE CONTENT ends here &#8211;&gt;</span></p>
<p><span style="color: #800000;">&lt;!&#8211; FOOTER starts here &#8211;&gt;<br />
&lt;div id=&#8221;footer&#8221;&gt;<br />
&lt;p&gt;Copyright © 2008. Tanzilo Insido PHPo MySQLo&lt;/p&gt;<br />
&lt;/div&gt;<br />
&lt;!&#8211; FOOTER ends here &#8211;&gt;</span></p>
<p><span style="color: #800000;">&lt;/div&gt;<br />
&lt;!&#8211; CONTAINER ends here &#8211;&gt;</span></p>
<p><span style="color: #800000;">&lt;/body&gt;<br />
&lt;/html&gt;</span></p>
<p><span style="text-decoration: underline;"><strong>Explanation for the 3 column design:</strong></span></p>
<p>When you understand 2 column design, it is very easy to understand the three column design too since they are very similar. Everything else are as they were but now we have three columns in the <span style="text-decoration: underline;">content</span> div:</p>
<p><span style="color: #800000;">&lt;div id=&#8221;leftColumn&#8221;&gt;&lt;/div&gt;<br />
&lt;div id=&#8221;middleColumn&#8221;&gt;&lt;/div&gt;<br />
&lt;div id=&#8221;rightColumn&#8221;&gt;&lt;/div&gt;</span></p>
<p>Left column CSS:</p>
<p><span style="color: #800000;">#leftColumn<br />
{<br />
width:200px; height:300px; background:#000000;<br />
text-align:left;<br />
float:left;<br />
}</span></p>
<p>Middle column CSS:</p>
<p><span style="color: #800000;">#middleColumn<br />
{<br />
width:375px; height:300px; background:#FFFFFF;<br />
text-align:left; color:#000000;<br />
float:left;<br />
}</span></p>
<p>Right column CSS:</p>
<p><span style="color: #800000;">#rightColumn<br />
{<br />
width:200px; height:300px; background:#003300;<br />
text-align:left; color:#CCCCCC;<br />
float:left;<br />
}<br />
</span></p>
<p>Well. Notice that (1) we are floating them all to the left direction to keep them side by side in column style and (2) the total width of all the three columns is (200 px + 375 px + 200 px) or 757 pixels which is exactly equal to the width of the <span style="text-decoration: underline;">container</span> div (775 pixels).</p>
<p><span style="color: #800000;">#container<br />
{<br />
width:775px; margin:0 auto;<br />
}</span></p>
<p>Thus, you can make as many columns as you want. But make sure the total width of all your columns is smaller than or equal to the available space (width).</p>
<p>I tries my best to keep this post as easy as possible. If you are not clear or do not understand the whole article at the first reading, I suggest you giving a second reading.</p>
<p>Thanks for reading.</p>
<p><map name='google_ad_map_6_eaab367e2f0158c1'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/6?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_6_eaab367e2f0158c1' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=6&amp;url= http%3A%2F%2Fwww.tanzilo.com%2F2008%2F10%2F24%2Ftableless-web-design-in-css-2-3-columns-with-header-footer%2F' /></p>]]></content:encoded>
			<wfw:commentRss>http://www.tanzilo.com/2008/10/24/tableless-web-design-in-css-2-3-columns-with-header-footer/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>

