<?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>Lost Resort Blog &#187; rounded corners using images; rounded corners without images; rounded corners container using CSS</title>
	<atom:link href="http://www.lostresort.biz/blog/tag/rounded-corners-using-images-rounded-corners-without-images-rounded-corners-container-using-css/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.lostresort.biz/blog</link>
	<description>Talking about us and about web site development</description>
	<lastBuildDate>Thu, 08 Jul 2010 11:34:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>How to create containers with rounded corners</title>
		<link>http://www.lostresort.biz/blog/2008/07/24/how-to-create-container-with-rounded-corners/</link>
		<comments>http://www.lostresort.biz/blog/2008/07/24/how-to-create-container-with-rounded-corners/#comments</comments>
		<pubDate>Thu, 24 Jul 2008 16:53:30 +0000</pubDate>
		<dc:creator>Cristi_N</dc:creator>
				<category><![CDATA[Web Design]]></category>
		<category><![CDATA[rounded corners using images; rounded corners without images; rounded corners container using CSS]]></category>

		<guid isPermaLink="false">http://www.lostresort.biz/blog/?p=13</guid>
		<description><![CDATA[In this days a element or a container with rounded corners creates a nice visual effect when navigating a website page. The effect can be done using some small size images, or with only pure and simple HTML code, without any images. If you wonder how can this be achieved I'll present a few techniques [...]]]></description>
			<content:encoded><![CDATA[<p>In this days a <<code>div</code>> element or a container with rounded corners creates a nice visual effect when navigating a website page. The effect can be done using some small size images, or with only pure and simple HTML code, without any images. If you wonder how can this be achieved I'll present a few techniques which may help you to create a box or a container with rounded corners, with some of my comments on each one. </p>
<h3>Nifty corners</h3>
<p>First one it's a simple and in some way useful choice of creating rounded corners using Nifty corners. The techniques involves no images just a few lines of HTML code. The idea belongs to Alessandro Fulciniti (we were borne in the same year <img src='http://www.lostresort.biz/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> ) and the main article can be found <a href="http://www.html.it/articoli/nifty/index.html">here</a>. He presents very well how to make a container with rounded corners. It works like this: you have a container when you want to place some text; on top and on the bottom of the <<code>div</code>> element a few <<code>b</code>> elements appear and using some <i>margin</i> attributes for the <<code>b</code>> elements the effect is created. Very simple and efficient.</p>
<p>The result can be seen <a href="http://www.html.it/articoli/nifty/nifty1.html">here</a>.</p>
<p>The HTML code for this container is presented bellow.</p>
<blockquote><p>
<<code>div id="container"</code>><br />
<<code>b class="rtop"</code>><br />
  <<code>b class="r1"</code>><<code>/b</code>> <<code>b class="r2"</code>><<code>/b</code>> <<code>b class="r3"</code>><<code>/b</code>> <<code>b class="r4"</code>><<code>/b</code>><br /><<code>/b</code>><br />
<<code>!--content goes here --</code>><br />
<<code>b class="rbottom"</code>><br />
  <<code>b class="r4"</code>><<code>/b</code>> <<code>b class="r3"</code>><<code>/b</code>> <<code>b class="r2"</code>><<code>/b</code>> <<code>b class="r1"</code>><<code>/b</code>><br />
<<code>/b</code>><br />
<<code>/div</code>>
</p>
</blockquote>
<p>and the CSS attributes for the elements are on the next lines:</p>
<blockquote><p>
.rtop, .rbottom{display:block}<br />
.rtop *, .rbottom *{display: block; height: 1px; overflow: hidden}<br />
.r1{margin: 0 5px}<br />
.r2{margin: 0 3px}<br />
.r3{margin: 0 2px}<br />
.r4{margin: 0 1px; height: 2px}
</p>
</blockquote>
<p>It's good to note that, because <<code>b</code>> is an <em>inline element</em>, and to be able to change the margin attribute we have to make it a <em>block element</em>, and this is accomplished using the CSS attribute <strong>{display:block}</strong>.</p>
<p>Quite impressionable I can say <img src='http://www.lostresort.biz/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  .</p>
<h3>Rounded corners using images for top and bottom area</h3>
<p>This second method is, I think, the most widespread technique for creating containers with rounded corners. The idea is to generate an image for the container's background, and split it in three pieces, one for the top area, another for the bottom area and the third one for the middle section. The height size of the last one can be as small as possible</p>
<p>The HTML code consists in only few lines:</p>
<blockquote><p>
<<code>div id="container"</code>><br />
	<<code>p class="top"</code>>some text here<<code>/p</code>><br />
	<<code>p</code>>some content here<<code>/p</code>><br />
	<<code>p</code>>some content here<<code>/p</code>><br />
	<<code>p class="bottom"</code>>some text here<<code>/p</code>><br />
<<code>/div</code>>
</p>
</blockquote>
<p>and the styles look like:</p>
<blockquote><p>
#container{margin:20px;background:url(middle.png) center repeat-y;width:420px}<br />
.top{background:url(top.png) no-repeat}<br />
.bottom{background:url(bottom.png) bottom no-repeat}<br />
p{padding:8px 10px 5px 20px}
</p>
</blockquote>
<p>Following this link you can see <a href="http://www.lostresort.biz/examples/rounded/rcexample.html">an example of rounded corners container</a>.</p>
<p>It's simple and more efficient than previous one, because in this case a border can be used, and it creates a nice visual effect. Note that, all images have less than 1Kb in size. Also the top <<code>p</code>> element can be replaced with a heading tag, like <<code>h3</code>>, so the container looks more interesting.</p>
<h3>Rounded corners using an image for each corner</h3>
<p>This method uses for each corner a small image representing the corner itself. It is very well presented <a href="http://www.webcredible.co.uk/user-friendly-resources/css/css-round-corners-borders.shtml">here</a> with a lot of comments how to create it.</p>
<p>Let's take a look at the HTML code:</p>
<blockquote><p>
<<code>div class="t"</code>><br />
<<code>div class="b"</code>><br />
<<code>div class="l"</code>><br />
<<code>div class="r"</code>><br />
<<code>div class="bl"</code>><br />
<<code>div class="br"</code>><br />
<<code>div class="tl"</code>><br />
<<code>div class="tr"</code>><br />
<<code>!--content goes here--</code>><br />
<<code>/div</code>><br />
<<code>/div</code>><br />
<<code>/div</code>><br />
<<code>/div</code>><br />
<<code>/div</code>><br />
<<code>/div</code>><br />
<<code>/div</code>><br />
<<code>/div</code>>
</p>
</blockquote>
<p>As you can see to achieve this effect this method needs <strong>eight</strong> <<code>div</code>> elements, which is quite consistent. This piece of code has exactly 174 chars (excluding the "content ..." text) which means that 174 bytes are "eating" the bandwidth every time the page is loaded.<br />
The styles also are written with consistency:</p>
<blockquote><p>
.t {background: url(dot.gif) 0 0 repeat-x; width: 20em}<br />
.b {background: url(dot.gif) 0 100% repeat-x}<br />
.l {background: url(dot.gif) 0 0 repeat-y}<br />
.r {background: url(dot.gif) 100% 0 repeat-y}<br />
.bl {background: url(bl.gif) 0 100% no-repeat}<br />
.br {background: url(br.gif) 100% 100% no-repeat}<br />
.tl {background: url(tl.gif) 0 0 no-repeat}<br />
.tr {background: url(tr.gif) 100% 0 no-repeat; padding:10px}
</p>
</blockquote>
<p>As a comparison with the previous method, this one uses <strong>five</strong> images for creating the effect. The good thing is that they are very small in size. </p>
<p>Until the <strong>'border-radius'</strong> CSS3 attribute will be implemented in web browsers' engine (you can read the specifications <a href="http://www.w3.org/TR/css3-background/">here</a> at paragraph 19), one of those methods presented above is good for creating containers with rounded corners.</p>
<p>Another method to get rounded corners is using JavaScript (ECMAScript), but this is another story <img src='http://www.lostresort.biz/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  .</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.lostresort.biz%2Fblog%2F2008%2F07%2F24%2Fhow-to-create-container-with-rounded-corners%2F&amp;linkname=How%20to%20create%20containers%20with%20rounded%20corners"><img src="http://www.lostresort.biz/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.lostresort.biz/blog/2008/07/24/how-to-create-container-with-rounded-corners/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
