<?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; DHTML</title>
	<atom:link href="http://www.tanzilo.com/category/dhtml/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>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>
<p>{code type=CSS}<br />
#topDiv<br />
{<br />
	background:url(images/round-top.jpg) left top no-repeat;<br />
	width:260px; height:20px;<br />
}<br />
{/code}</p>
<p>And here is the HTML code:</p>
<p>{code type=HTML}</p>
<div id="topDiv"></div>
<p>{/code}</p>
<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>
<p>{code type=CSS}<br />
#middleDiv<br />
{<br />
	background:#FF6801; width:240px; height:100%; padding:0px 10px 0px 10px;<br />
}<br />
{/code}</p>
<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>
<p>{code type=HTML}</p>
<div id="middleDiv">
    	This is a line to show how it is going with the content.</p>
<p>        This my another line of content.
    </p></div>
<p>{/code}</p>
<p><span style="text-decoration: underline;"><strong>Step Five: Setting the bottom</strong></span></p>
<p>Here is the CSS code:</p>
<p>{code type=CSS}<br />
#bottomDiv<br />
{<br />
	background:url(images/round-bottom.jpg) left bottom no-repeat;<br />
	width:260px; height:20px;<br />
}<br />
{/code}</p>
<p>And here is the HTML code:</p>
<p>{code type=CSS}</p>
<div id="bottomDiv"></div>
<p>{/code}</p>
<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>
<p>{code type=CSS}</p>
<style type="text/css">
#topDiv
{
	background:url(images/round-top.jpg) left top no-repeat;
	width:260px; height:20px;
}
#middleDiv
{
	background:#FF6801; width:240px; height:100%; padding:0px 10px 0px 10px;
}
#bottomDiv
{
	background:url(images/round-bottom.jpg) left bottom no-repeat;
	width:260px; height:20px;
}
</style>
<p>{/code}</p>
<p>And here is the HTML code:</p>
<p>{code type=HTML}<br />
<body></p>
<div id="topDiv"></div>
<div id="middleDiv">
    	This is a line to show how it is going with the content.</p>
<p>        This my another line of content.
    </p></div>
<div id="bottomDiv"></div>
<p></body><br />
{/code}</p>
<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>
<p>{code type=CSS}<br />
.roundTable<br />
{<br />
	width:260px; border:0px;<br />
}<br />
{/code}</p>
<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>
<p>{code type=HTML}</p>
<table border="0" cellpadding="0" cellspacing="0" class="roundTable">
{/code}</p>
<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>
<p>{code type=CSS}<br />
.topTD<br />
{<br />
	background:url(images/round-top.jpg) left top no-repeat;<br />
	height:20px;<br />
}<br />
{/code}</p>
<p>And here is the HTML code:</p>
<p>{code type=HTML}</p>
<tr>
<td class="topTD">&nbsp;</td>
</tr>
<p>{/code}</p>
<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>
<p>{code type=CSS}<br />
.middleTD<br />
{<br />
	background:#FF6801; padding:0px 10px 0px 10px;<br />
}<br />
{/code}</p>
<p>And here is the HTML code:</p>
<p>{code type=HTML}</p>
<tr>
<td class="middleTD">
			This is a line to show how it is going with the content.</p>
<p>			This my another line of content.
		</td>
</tr>
<p>{/code}</p>
<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>
<p>{code type=CSS}<br />
.bottomTD<br />
{<br />
	background:url(images/round-bottom.jpg) left bottom no-repeat;<br />
	height:20px;<br />
}<br />
{/code}</p>
<p>And here is the HTML code:</p>
<p>{code type=HTML}</p>
<tr>
<td class="bottomTD">&nbsp;</td>
</tr>
<p>{/code}</p>
<p><span style="text-decoration: underline;"><strong>Step Seven: Code altogether</strong></span></p>
<p>Here is the CSS code:</p>
<p>{code type=CSS}</p>
<style type="text/css">
.roundTable
{
	width:260px; border:0px;
}
.topTD
{
	background:url(images/round-top.jpg) left top no-repeat;
	height:20px;
}
.middleTD
{
	background:#FF6801; padding:0px 10px 0px 10px;
}
.bottomTD
{
	background:url(images/round-bottom.jpg) left bottom no-repeat;
	height:20px;
}
</style>
<p>{/code}</p>
<p>And here is the HTML code:</p>
<p>{code type=HTML}<br />
<body></p>
<table border="0" cellpadding="0" cellspacing="0" class="roundTable">
<tr>
<td class="topTD">&nbsp;</td>
</tr>
<tr>
<td class="middleTD">
				This is a line to show how it is going with the content.</p>
<p>				This my another line of content.
			</td>
</tr>
<tr>
<td class="bottomTD">&nbsp;</td>
</tr>
</table>
<p></body><br />
{/code}</p>
<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>11</slash:comments>
		</item>
	</channel>
</rss>

