<?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; CSS</title>
	<atom:link href="http://www.tanzilo.com/category/css/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, 17 Jan 2009 22:17:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
		<item>
		<title>Round image corner in HTML &amp; CSS using Table or DIV</title>
		<link>http://www.tanzilo.com/2008/11/08/round-image-corner-in-html-css-using-table-or-div/</link>
		<comments>http://www.tanzilo.com/2008/11/08/round-image-corner-in-html-css-using-table-or-div/#comments</comments>
		<pubDate>Sat, 08 Nov 2008 07:27:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[DHTML]]></category>
		<category><![CDATA[circular]]></category>
		<category><![CDATA[corner]]></category>
		<category><![CDATA[DIV]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[oval]]></category>
		<category><![CDATA[Round]]></category>
		<category><![CDATA[Table]]></category>

		<guid isPermaLink="false">http://www.tanzilo.com/?p=26</guid>
		<description><![CDATA[Many times in many sites, you have of course seen round or circular corners. Developers often use round corners to give the site more attractive and professional look. When I was new to web development and trying to figure out how to make the tables&#8217; corners round or circular or oval, I thought it must [...]]]></description>
			<content:encoded><![CDATA[<p>Many times in many sites, you have of course seen round or circular corners. Developers often use round corners to give the site more attractive and professional look. When I was new to web development and trying to figure out how to make the tables&#8217; corners round or circular or oval, I thought it must be a very tough task. Because I was searching solution in Google.com and all the solutions I found was either tough or I could not like. Ha ha. Later I found my own way. But I am sure many developers are using this already.</p>
<p>Here I share my easy and simple way:</p>
<h1>Round Corner in DIV:</h1>
<p><span style="text-decoration: underline;"><strong>Step One: Creating a colorful table in Adobe Photoshop, Illustrator or any other tool</strong></span></p>
<p>I have used Adobe Illustrator&#8217;s <strong>Rounded Rectangle Tool</strong> to create a round corner image. Then I saved it as &#8216;Save for web&#8217;, JPG format and in maximum image resolution. Here is the orange color round corner image:</p>
<p><img class="alignnone size-full wp-image-27" title="orange-color-table" src="http://www.tanzilo.com/wp-content/uploads/2008/11/orange-color-table.jpg" border="0" alt="" width="260" height="246" style="clear:both; border:0px; float:none;" /></p>
<p><span style="text-decoration: underline;"><strong>Step Two: Separating the top and bottom</strong></span></p>
<p>Now I cut 20 pixels from the top of the rounded image and I name it as &#8217;round-top.jpg&#8217;. Here it is:</p>
<p><img class="alignnone size-medium wp-image-28" title="round-top" src="http://www.tanzilo.com/wp-content/uploads/2008/11/round-top.jpg" border="0" alt="" width="260" height="20" style="clear:both; border:0px; float:none;" /></p>
<p>It is 260 pixels in width and 20 pixels in height.</p>
<p>Next I cut 20 pixels from the bottom of the rounded image and I name it as &#8217;round-bottom.jpg&#8217;. Here it is:</p>
<p><img class="alignnone size-medium wp-image-29" title="round-bottom" src="http://www.tanzilo.com/wp-content/uploads/2008/11/round-bottom.jpg" border="0" alt="" width="260" height="20" style="clear:both; border:0px; float:none;" /></p>
<p>It is 260 pixels in width and 20 pixels in height.</p>
<p><span style="text-decoration: underline;"><strong>Step Three: Setting the top</strong></span></p>
<p>Here is the CSS code:</p>
<pre class="css">
#topDiv
<span class="cssSelector">{</span>
	<span class="cssProperty">background</span><span class="cssRest">:</span><span class="cssValue">url(images/round-top.jpg) left top no-repeat</span><span class="cssRest">;</span>
	<span class="cssProperty">width</span><span class="cssRest">:</span><span class="cssValue">260px</span><span class="cssRest">;</span> <span class="cssProperty">height</span><span class="cssRest">:</span><span class="cssValue">20px</span><span class="cssRest">;</span>
<span class="cssSelector">}</span>
</pre>
<p>And here is the HTML code:</p>
<pre class="html">
	<span class="htmlOtherTag">&lt;div id=<span class="htmlAttributeValue">&quot;topDiv&quot;</span>&gt;</span><span class="htmlOtherTag">&lt;/div&gt;</span>
</pre>
<p><span style="text-decoration: underline;"><strong>Step Four: Setting the mid section</strong></span></p>
<p>In the mid section we are going to place another DIV and we will put our text, image or any other content inside it. Here is the CSS code:</p>
<pre class="css">
#middleDiv
<span class="cssSelector">{</span>
	<span class="cssProperty">background</span><span class="cssRest">:</span><span class="cssValue">#FF6801</span><span class="cssRest">;</span> <span class="cssProperty">width</span><span class="cssRest">:</span><span class="cssValue">240px</span><span class="cssRest">;</span> <span class="cssProperty">height</span><span class="cssRest">:</span><span class="cssValue">100%</span><span class="cssRest">;</span> <span class="cssProperty">padding</span><span class="cssRest">:</span><span class="cssValue">0px 10px 0px 10px</span><span class="cssRest">;</span>
<span class="cssSelector">}</span>
</pre>
<p>Notice that although the width of other DIVs is 260 pixels, this DIV has only 240 pixels. That means 20 pixels smaller than other DIVs. This is because we are giving 10 pixels padding in left and 10 pixels padding in right. This total 20 pixels padding will be added with our 240 pixels and make the DIV size looking like a 260 pixel DIV.</p>
<p>And here is the HTML code:</p>
<pre class="html">
<span class="htmlOtherTag">&lt;div id=<span class="htmlAttributeValue">&quot;middleDiv&quot;</span>&gt;</span>
    	This is a line to show how it is going with the content.<span class="htmlOtherTag">&lt;br /&gt;</span><span class="htmlOtherTag">&lt;br /&gt;</span>
        This my another line of content.
    <span class="htmlOtherTag">&lt;/div&gt;</span>
</pre>
<p><span style="text-decoration: underline;"><strong>Step Five: Setting the bottom</strong></span></p>
<p>Here is the CSS code:</p>
<pre class="css">
#bottomDiv
<span class="cssSelector">{</span>
	<span class="cssProperty">background</span><span class="cssRest">:</span><span class="cssValue">url(images/round-bottom.jpg) left bottom no-repeat</span><span class="cssRest">;</span>
	<span class="cssProperty">width</span><span class="cssRest">:</span><span class="cssValue">260px</span><span class="cssRest">;</span> <span class="cssProperty">height</span><span class="cssRest">:</span><span class="cssValue">20px</span><span class="cssRest">;</span>
<span class="cssSelector">}</span>
</pre>
<p>And here is the HTML code:</p>
<pre class="css">
    &lt;div id=<span class="cssString">"bottomDiv"</span>&gt;&lt;/div&gt;
</pre>
<p><span style="text-decoration: underline;"><strong>Step Six: Code altogether</strong></span></p>
<p>If we put all code together, it will look like this:</p>
<p>Here is the CSS code:</p>
<pre class="css">
&lt;style type=<span class="cssString">"text/css"</span>&gt;
#topDiv
<span class="cssSelector">{</span>
	<span class="cssProperty">background</span><span class="cssRest">:</span><span class="cssValue">url(images/round-top.jpg) left top no-repeat</span><span class="cssRest">;</span>
	<span class="cssProperty">width</span><span class="cssRest">:</span><span class="cssValue">260px</span><span class="cssRest">;</span> <span class="cssProperty">height</span><span class="cssRest">:</span><span class="cssValue">20px</span><span class="cssRest">;</span>
<span class="cssSelector">}</span>
#middleDiv
<span class="cssSelector">{</span>
	<span class="cssProperty">background</span><span class="cssRest">:</span><span class="cssValue">#FF6801</span><span class="cssRest">;</span> <span class="cssProperty">width</span><span class="cssRest">:</span><span class="cssValue">240px</span><span class="cssRest">;</span> <span class="cssProperty">height</span><span class="cssRest">:</span><span class="cssValue">100%</span><span class="cssRest">;</span> <span class="cssProperty">padding</span><span class="cssRest">:</span><span class="cssValue">0px 10px 0px 10px</span><span class="cssRest">;</span>
<span class="cssSelector">}</span>
#bottomDiv
<span class="cssSelector">{</span>
	<span class="cssProperty">background</span><span class="cssRest">:</span><span class="cssValue">url(images/round-bottom.jpg) left bottom no-repeat</span><span class="cssRest">;</span>
	<span class="cssProperty">width</span><span class="cssRest">:</span><span class="cssValue">260px</span><span class="cssRest">;</span> <span class="cssProperty">height</span><span class="cssRest">:</span><span class="cssValue">20px</span><span class="cssRest">;</span>
<span class="cssSelector">}</span>
&lt;/style&gt;
</pre>
<p>And here is the HTML code:</p>
<pre class="html">
<span class="htmlOtherTag">&lt;body&gt;</span>
    <span class="htmlOtherTag">&lt;div id=<span class="htmlAttributeValue">&quot;topDiv&quot;</span>&gt;</span><span class="htmlOtherTag">&lt;/div&gt;</span>
    <span class="htmlOtherTag">&lt;div id=<span class="htmlAttributeValue">&quot;middleDiv&quot;</span>&gt;</span>
    	This is a line to show how it is going with the content.<span class="htmlOtherTag">&lt;br /&gt;</span><span class="htmlOtherTag">&lt;br /&gt;</span>
        This my another line of content.
    <span class="htmlOtherTag">&lt;/div&gt;</span>
    <span class="htmlOtherTag">&lt;div id=<span class="htmlAttributeValue">&quot;bottomDiv&quot;</span>&gt;</span><span class="htmlOtherTag">&lt;/div&gt;</span>
<span class="htmlOtherTag">&lt;/body&gt;</span>
</pre>
<p>And that&#8217;s it!</p>
<p>You can see the demo here: <a title="Demo of rounded corner in DIV" href="http://www.tanzilo.com/demo/code/round_corner/div/index.html" target="_blank">Demo of rounded corner in DIV</a><br />
I suggest you visiting this link, opening the source code and taking a look.</p>
<h1>Round Corner in Table:</h1>
<p><span style="text-decoration: underline;"><strong>Step One: Creating a colorful table in Adobe Photoshop, Illustrator or any other tool</strong></span></p>
<p>Just follow the same as <strong>Step One</strong> of the <strong>Round Corner in DIV</strong> section above.</p>
<p><span style="text-decoration: underline;"><strong>Step Two: Separating the head and bottom</strong></span></p>
<p>Just follow the same as <strong>Step Two</strong> of the <strong>Round Corner in DIV</strong> section above.</p>
<p><span style="text-decoration: underline;"><strong>Step Three: Setting the table tag</strong></span></p>
<p>Here is the CSS code:</p>
<pre class="css">
.roundTable
<span class="cssSelector">{</span>
	<span class="cssProperty">width</span><span class="cssRest">:</span><span class="cssValue">260px</span><span class="cssRest">;</span> <span class="cssProperty">border</span><span class="cssRest">:</span><span class="cssValue">0px</span><span class="cssRest">;</span>
<span class="cssSelector">}</span>
</pre>
<p>Notice that we have set the table widht to 260 pixels that is equal to our top and bottom images&#8217; width. We do not need to mention the table width to any other place.</p>
<p>And here is the HTML code:</p>
<pre class="html">
	<span class="htmlTableTag">&lt;table border=<span class="htmlAttributeValue">&quot;0&quot;</span> cellpadding=<span class="htmlAttributeValue">&quot;0&quot;</span> cellspacing=<span class="htmlAttributeValue">&quot;0&quot;</span> class=<span class="htmlAttributeValue">&quot;roundTable&quot;</span>&gt;</span>
</pre>
<p><span style="text-decoration: underline;"><strong>Step Four: Setting the top</strong></span></p>
<p>We simply set the TD background to &#8217;round-top.jpg&#8217; and set its height equals to the &#8217;round-top.jpg&#8217; image which is 20 pixels.</p>
<p>Here is the CSS code:</p>
<pre class="css">
.topTD
<span class="cssSelector">{</span>
	<span class="cssProperty">background</span><span class="cssRest">:</span><span class="cssValue">url(images/round-top.jpg) left top no-repeat</span><span class="cssRest">;</span>
	<span class="cssProperty">height</span><span class="cssRest">:</span><span class="cssValue">20px</span><span class="cssRest">;</span>
<span class="cssSelector">}</span>
</pre>
<p>And here is the HTML code:</p>
<pre class="html">
	<span class="htmlTableTag">&lt;tr&gt;</span>
		<span class="htmlTableTag">&lt;td class=<span class="htmlAttributeValue">&quot;topTD&quot;</span>&gt;</span><span class="htmlSpecialChar">&amp;nbsp;</span><span class="htmlTableTag">&lt;/td&gt;</span>
	<span class="htmlTableTag">&lt;/tr&gt;</span>
</pre>
<p><span style="text-decoration: underline;"><strong>Step Five: Setting the middle section for the content</strong></span></p>
<p>We simply keep 10 pixels padding in both left and right side and set the background.</p>
<p>Here is the CSS code:</p>
<pre class="css">
.middleTD
<span class="cssSelector">{</span>
	<span class="cssProperty">background</span><span class="cssRest">:</span><span class="cssValue">#FF6801</span><span class="cssRest">;</span> <span class="cssProperty">padding</span><span class="cssRest">:</span><span class="cssValue">0px 10px 0px 10px</span><span class="cssRest">;</span>
<span class="cssSelector">}</span>
</pre>
<p>And here is the HTML code:</p>
<pre class="html">
	<span class="htmlTableTag">&lt;tr&gt;</span>
		<span class="htmlTableTag">&lt;td class=<span class="htmlAttributeValue">&quot;middleTD&quot;</span>&gt;</span>
			This is a line to show how it is going with the content.<span class="htmlOtherTag">&lt;br /&gt;</span><span class="htmlOtherTag">&lt;br /&gt;</span>
			This my another line of content.
		<span class="htmlTableTag">&lt;/td&gt;</span>
	<span class="htmlTableTag">&lt;/tr&gt;</span>
</pre>
<p><span style="text-decoration: underline;"><strong>Step Six: Setting the bottom</strong></span></p>
<p>We simply set the TD background to &#8217;round-bottom.jpg&#8217; and set its height equals to the &#8217;round-bottom.jpg&#8217; image which is 20 pixels.</p>
<p>Here is the CSS code:</p>
<pre class="css">
.bottomTD
<span class="cssSelector">{</span>
	<span class="cssProperty">background</span><span class="cssRest">:</span><span class="cssValue">url(images/round-bottom.jpg) left bottom no-repeat</span><span class="cssRest">;</span>
	<span class="cssProperty">height</span><span class="cssRest">:</span><span class="cssValue">20px</span><span class="cssRest">;</span>
<span class="cssSelector">}</span>
</pre>
<p>And here is the HTML code:</p>
<pre class="html">
	<span class="htmlTableTag">&lt;tr&gt;</span>
		<span class="htmlTableTag">&lt;td class=<span class="htmlAttributeValue">&quot;bottomTD&quot;</span>&gt;</span><span class="htmlSpecialChar">&amp;nbsp;</span><span class="htmlTableTag">&lt;/td&gt;</span>
	<span class="htmlTableTag">&lt;/tr&gt;</span>
</pre>
<p><span style="text-decoration: underline;"><strong>Step Seven: Code altogether</strong></span></p>
<p>Here is the CSS code:</p>
<pre class="css">
&lt;style type=<span class="cssString">"text/css"</span>&gt;
.roundTable
<span class="cssSelector">{</span>
	<span class="cssProperty">width</span><span class="cssRest">:</span><span class="cssValue">260px</span><span class="cssRest">;</span> <span class="cssProperty">border</span><span class="cssRest">:</span><span class="cssValue">0px</span><span class="cssRest">;</span>
<span class="cssSelector">}</span>
.topTD
<span class="cssSelector">{</span>
	<span class="cssProperty">background</span><span class="cssRest">:</span><span class="cssValue">url(images/round-top.jpg) left top no-repeat</span><span class="cssRest">;</span>
	<span class="cssProperty">height</span><span class="cssRest">:</span><span class="cssValue">20px</span><span class="cssRest">;</span>
<span class="cssSelector">}</span>
.middleTD
<span class="cssSelector">{</span>
	<span class="cssProperty">background</span><span class="cssRest">:</span><span class="cssValue">#FF6801</span><span class="cssRest">;</span> <span class="cssProperty">padding</span><span class="cssRest">:</span><span class="cssValue">0px 10px 0px 10px</span><span class="cssRest">;</span>
<span class="cssSelector">}</span>
.bottomTD
<span class="cssSelector">{</span>
	<span class="cssProperty">background</span><span class="cssRest">:</span><span class="cssValue">url(images/round-bottom.jpg) left bottom no-repeat</span><span class="cssRest">;</span>
	<span class="cssProperty">height</span><span class="cssRest">:</span><span class="cssValue">20px</span><span class="cssRest">;</span>
<span class="cssSelector">}</span>
&lt;/style&gt;
</pre>
<p>And here is the HTML code:</p>
<pre class="html">
<span class="htmlOtherTag">&lt;body&gt;</span>
	<span class="htmlTableTag">&lt;table border=<span class="htmlAttributeValue">&quot;0&quot;</span> cellpadding=<span class="htmlAttributeValue">&quot;0&quot;</span> cellspacing=<span class="htmlAttributeValue">&quot;0&quot;</span> class=<span class="htmlAttributeValue">&quot;roundTable&quot;</span>&gt;</span>
		<span class="htmlTableTag">&lt;tr&gt;</span>
			<span class="htmlTableTag">&lt;td class=<span class="htmlAttributeValue">&quot;topTD&quot;</span>&gt;</span><span class="htmlSpecialChar">&amp;nbsp;</span><span class="htmlTableTag">&lt;/td&gt;</span>
		<span class="htmlTableTag">&lt;/tr&gt;</span>
		<span class="htmlTableTag">&lt;tr&gt;</span>
			<span class="htmlTableTag">&lt;td class=<span class="htmlAttributeValue">&quot;middleTD&quot;</span>&gt;</span>
				This is a line to show how it is going with the content.<span class="htmlOtherTag">&lt;br /&gt;</span><span class="htmlOtherTag">&lt;br /&gt;</span>
				This my another line of content.
			<span class="htmlTableTag">&lt;/td&gt;</span>
		<span class="htmlTableTag">&lt;/tr&gt;</span>
		<span class="htmlTableTag">&lt;tr&gt;</span>
			<span class="htmlTableTag">&lt;td class=<span class="htmlAttributeValue">&quot;bottomTD&quot;</span>&gt;</span><span class="htmlSpecialChar">&amp;nbsp;</span><span class="htmlTableTag">&lt;/td&gt;</span>
		<span class="htmlTableTag">&lt;/tr&gt;</span>
	<span class="htmlTableTag">&lt;/table&gt;</span>
<span class="htmlOtherTag">&lt;/body&gt;</span>
</pre>
<p>And that&#8217;s it!</p>
<p>You can see the demo here: <a title="Demo of rounded corner in TABLE" href="http://www.tanzilo.com/demo/code/round_corner/table/index.html" target="_blank">Demo of rounded corner in TABLE</a><br />
I suggest you visiting this link, opening the source code and taking a look.</p>
<p>By the way, nowadays I am no more using tables. Rather I have shifted to table-less CSS based DIV style design. And I feel very comfortable using this technique in my DIV structured design.</p>
<p>You can download sample code from here:<br />
<a title="Round corner source code" href="http://www.tanzilo.com/demo/code/round_corner/round_corner.zip"> Source Code for Round image corner in HTML &amp; CSS using Table or DIV</a></p>
<p>Thanks for reading.</p>
<p><map name='google_ad_map_26_eaab367e2f0158c1'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/26?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_26_eaab367e2f0158c1' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=26&amp;url= http%3A%2F%2Fwww.tanzilo.com%2F2008%2F11%2F08%2Fround-image-corner-in-html-css-using-table-or-div%2F' /></p>]]></content:encoded>
			<wfw:commentRss>http://www.tanzilo.com/2008/11/08/round-image-corner-in-html-css-using-table-or-div/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<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>
