Tuesday, July 10, 2007

Boxes With Rounded Corners In Your Website using CSS

I just learned a simple but great technique of creating boxes with rounded corners in your website. The basic idea is to get some coulored lines to get the rounded effect. So, just use the HTML code:

<div id="container">
<b class="rtop">
<b class="r1"></b>
<b class="r2"></b>
<b class="r3"></b>
<b class="r4"></b>
</b>
<!--content goes here -->
<b class="rbottom">
<b class="r4"></b>
<b class="r3"></b>
<b class="r2"></b>
<b class="r1"></b>
</b>
</div>

And insert it anywhere in the HTML page wether it be in a table or paragraph. Make sure that you also insert the following CSS codes in between the <head> tags:

<style type="text/css"">
div#nifty{ background-color:#CCCCCC; }
b.rtop, b.rbottom{display:block;background: #999966}
b.rtop b, b.rbottom b{display:block;height: 1px; overflow: hidden; background-color:#CCCCCC}
b.r1{margin: 0 5px}b.r2{margin: 0 3px}b.r3{margin: 0 2px}
b.rtop b.r4, b.rbottom b.r4{margin: 0 1px;height: 2px}
</style<

There you go! Instant box with round corners. You can play around with the attributes to achieve your desired preference. I would like to thank www.html.it for providing this tutorial.

No comments: