Home/Tutorials/CSS/Rounded Corners! - Border Radius

0 of 2 saved

CSS2 min read

Rounded Corners! - Border Radius

Read this chapter, then pass a short check to open the next one.

In this tutorial we will learn how to make the corners round for any element using CSS border radius property.

CSS Border Radius

From CSS3 onwards, we can easily provide rounded corners to any element using the border-radius property.

p {
    background-color:orange;
    padding:10px;
    /* setting border radius */
    border-radius: 4px;
}

Live Example โ†’


Syntax of border:radius

Using the property border-radius is pretty straight forward, all you have to do is specify the curvature in terms of px, em or % for rounding the corners.

Syntax:

border-radius: top-left top-right bottom-right bottom-left

In the above code, top-left will be the value for rounding the top-left corner, similarly top-right will be the value for top-right corner and so on.

We can skip any value, or specify the value 0 for it, to not round that particular corner. And we can also, set different curvatures for all the corners as well.

p {
    background-color:orange;
    padding:10px;
    /* setting border radius */
    border-radius: 4px 8px 12px 16px;
}

Live Example โ†’