how to make curve corner using css

grookseo

New Member
In this tutorial , we will make css curved corners using a very easy and simple technique .

In the past , people used images to make a curved corners , but now we will make it without any image .

Let’s start how to make css curved corners :



First of all , I will make this HTML code :-

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

<head>

<title>css curved corners</title>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

<link media="screen" type="text/css" rel="stylesheet" href="css-curved-corners.css" />

</head>

<body>

<div id="curved-corner-example">

</div>

</body>

</html>







Ok , now we won’t change the HTML , we will just change the css code



Make a css file (I called it css-curved-corners.css)

and put this code in it :-

#curved-corner-example {

height: 400px;

width: 150px;

background: #81b6b7;

margin: 25px auto;

padding: 8px;

}



And you will have something like that :-

1-curved.jpg

Ok , now we want to make curved corners , so just add this line into out css code



border-radius: 20px 20px 20px 20px;



and our CSS code will be :



#curved-corner-example {

height: 400px;

width: 150px;

background: #81b6b7;

margin: 25px auto;

padding: 8px;

border-radius: 20px 20px 20px 20px;

}

And it will be something like that

And you will have something like that :-
2-curved.jpg


Ok now we want to make some changes , I want to curve some corners more than the others . so I’ll change the css code into this :



#curved-corner-example {

height: 400px;

width: 150px;

background: #81b6b7;

margin: 25px auto;

padding: 8px;

border-radius: 20px 2px 20px 2px;

}



As you see , 2 corners are curved with 20px radius , and the others are curved with 2px radius .



And it will be :-

And you will have something like that :-

3-curved.jpg

Finally , you can combine this technique with other techniques we used in previous lesson , I’ll combine it with shadow and border , so our code will be :-



#curved-corner-example {

height: 400px;

width: 150px;

background: #81b6b7;

margin: 25px auto;

padding: 8px;

border-radius: 20px 2px 20px 2px;

border-style:solid;

border-width:1px;

-moz-box-shadow: 3px 3px 10px #000;

-webkit-box-shadow: 3px 3px 10px #000;

box-shadow: 3px 3px 10px #000;

}

and the result :-

And you will have something like that :-

4-curved.jpg


End of the tutorial .

Source :- CSS Curved Corners

for more Tutorial , you can visit the source .

thanks
 

RoboticPro

New Member
You know that not every browser supports it?
Including the most used IE before version 9
so it's better to do a browser detection and
on that select your way to use it.
 

PannaDraws

New Member
Actually it's not supported in IE... I usually check css3.info for the latest support news. Anyway, I also use a lot this to get nice rounded corners, or even circles.
 
Weather it is supported by IE or not, the fact remains that, those of us who didnt know how to go about it have learned something new.
However, those who say it is not supported by IE should tell us what to do: Maybe we use Safari, Firefox of others.

Thanks,
Golden Waters.
 

PixelPusher

Super Moderator
Staff member
You will need to "-moz" prefix for FireFox for border radius. All other css3 supporting browsers will be fine with the standard property.
 
Top