User Interface and Web Designer. Designing clean, professional websites and logos to serve all needs.

 09/2006 - NewWebPick  09/2006 - Bronze Mowsnet Web Award Coolhomepages.com Award  09/2006 - Spy Line  09/2006 - lovetatoo  09/2006 - internetvibes  09/2006 - netculture  09/2006 - My Design Award  09/2006 - Design Firms  e-motion Award  Linkas Design Award  masquepremios.com - Web de Plata Award


Tel: +20101011527

Previous Posts



Powered by Blogger

Add to Technorati Favorites

Subscribe to
Posts [Atom]


Web Design Logos Print Photography Blog

Saturday, February 24, 2007

How to create rounded corner box using CSS

For a long time web designers were using table tags to create rounded corner tables or boxes. They all used the same method, three rows by three columns to be able to create flexible tables with rounded corner. This way is absolutely gone and we are no longer using it now, we are using the CSS method, which is easier and faster.


ONE

First thing is to prepare all your rounded corner images


Then create a normal <div> box
HTML:
<div class="box"></div>

CSS:
.box {width:200px; height:200px; background-color:#FFFFFF;}



TWO

After that we add the top left background to it, or whatever corner you would like to add. The CSS will be:
.box {
width:200px;
height:200px;
background-color:#FFFFFF;
background-image:url(images/tLeft.gif);
background-position:top left;
margin:0px; padding:0px;
background-repeat:no-repeat;
}

This is your progress till now:




THREE

Create another <div> tag inside the first one and add the top right background to it.
HTML:
<div class="box"><div class="tRight">
</div></div>

CSS:
.box {
width:200px;
height:200px;
background-color:#FFFFFF;
background-image:url(images/tLeft.gif);
background-position:top left;
margin:0px; padding:0px;
background-repeat:no-repeat;
}

.tRight
{
width:200px;
height:200px;
background-image:url(images/tRight.gif);
background-position:top right;
margin:0px; padding:0px;
background-repeat:no-repeat;
}

This is your progress till now:




FOUR

Create another <div> tag inside and add the bottom Right background to it.
HTML:
<div class="box"><div class="tRight"><div class="bRight">
</div></div></div>

CSS:
.box {
width:200px;
height:200px;
background-color:#FFFFFF;
background-image:url(images/tLeft.gif);
background-position:top left;
margin:0px; padding:0px;
background-repeat:no-repeat;
}

.tRight
{
width:200px;
height:200px;
background-image:url(images/tRight.gif);
background-position:top right;
margin:0px; padding:0px;
background-repeat:no-repeat;
}

.bRight
{
width:200px;
height:200px;
background-image:url(images/bRight.gif);
background-position:bottom right;
margin:0px; padding:0px;
background-repeat:no-repeat;
}

This is your progress till now:



FIVE and the LAST STEP

The last corner to add, do the same and add the forth <div> tag inside with the bottom left corner in the backround of it.

HTML:
<div class="box"><div class="tRight"><div class="bRight"><div class="bLeft">
</div></div></div></div>

CSS:
.box {
width:200px;
height:200px;
background-color:#FFFFFF;
background-image:url(images/tLeft.gif);
background-position:top left;
margin:0px; padding:0px;
background-repeat:no-repeat;
}

.tRight
{
width:200px;
height:200px;
background-image:url(images/tRight.gif);
background-position:top right;
margin:0px; padding:0px;
background-repeat:no-repeat;
}

.bRight
{
width:200px;
height:200px;
background-image:url(images/bRight.gif);
background-position:bottom right;
margin:0px; padding:0px;
background-repeat:no-repeat;
}

.bLeft
{
width:200px;
height:200px;
background-image:url(images/bLeft.gif);
background-position:bottom left;
margin:0px; padding:0px;
background-repeat:no-repeat;
}

This is your final output:



EXAMPLE

The online HTML example here
StumbleUpon Toolbar

4 Comments:

Blogger Ahmad said...

Thank you Mostafa for your great contributions. I wish you all the best in life and after inshallah

February 26, 2007 1:50 PM  
Blogger suresh said...

thank u very much mr. mostafa. Really its very easy to understand and to follow the steps.

All best...

January 18, 2008 8:44 AM  
Anonymous Anonymous said...

Your site helped me understand the basic elements of how to design 'table-less' corners using CSS. Thank you!

March 8, 2008 12:26 AM  
Blogger aju said...

How i create a css round box using 8 images.(top left,top right,top middle,left,right,bottom left,bottom middle,bottom right).

May 30, 2008 11:34 AM  

Post a Comment


<< Home

 
© 2007 Designrific.