new course
CSS grid landing page tutorial (36min)

Lesson info

From rounded corners to perfect circles and everything in between, border radius gives you control over each corner of an element. In this video, we'll show you how.

Lesson info

Explore this project

Want to dig into the project featured in this video and see how everything is put together? We've included the full project we used when making this lesson, and we've shared the link right under this very paragraph.

View and clone this projectDownload lesson assets

Related tutorial

Clone this projectDownload project assets


From rounded corners to perfect circles — and everything in between — Border Radius gives us the control over each corner of an element.

We'll cover five different topics here regarding border radius:

Rounded rectangle, the capsule (or pill) shape, ellipse, circle, and we'll end by talking about setting properties on each individual corner.

Let's start with rounded rectangles.

Here are some images. Each of them — each photo — has the same class applied. We can see this in our Selector field. And what we'll do is go down to add a Border Radius by changing this value.

We can see the rounding being applied to all four corners. And we can also see that by default, the rounding — that radius is set in pixels.

So regardless of whether your element is a rectangle or a perfect square, the cornering will be circular.

Want to clear the radius value? We can go in and remove that value.

That's working with a rounded rectangle.

Let's do a capsule.

Same thing here: we're starting with a rectangular shape. And as we increase the pixel value for the radius, we start to approach the pill shape. In all modern browsers, you can set an obscenely high number here and it'll still conform to a perfect capsule or pill shape. We'll do 470px.

That's a capsule.

What about an ellipse?

We can apply a percentage value to our border radius, and anytime that hits 50%? We have a beautiful, smooth rendering of an ellipse.

Now if we change the text inside our button? We can see clearly that the rounding — the shape of the ellipse — is directly correlated with the width of the element. The aspect ratio of the ellipse is based on the relationship between its width and height.

But what about an ellipse that has the same width and height? In other words...

How do we do a circle?

Well, if we're working with an element that doesn't have defined dimensions, we'll have to add them. The width and height can be anything you come up with, but for this to be circular, those values should be equal.

And all we have to do to create a circle, set the radius to 50%. It's the greatest thing in history. Look how amazing this is. We just rounded out a bunch of photos. We didn't even have to touch Photoshop.

That's creating a circle.

Let's play with individual corners.

All this time we've had all corners selected. For the class applied to this div block, we can add upper-left rounding only at 50px. And it only affects the upper-left. Let's do the same thing on the bottom-right.

Or, we can clear the bottom-right by holding down option or alt and pressing on the blue indicator. And we can instead add 50px to the top-right.

Okay, let's go back to the upper-left and change it to 20%. The point here is that corners don't need to match; you can create really odd shapes.

And keep in mind: If the width and height of the element we're styling are different? Using percentages will give us elliptical corners with the same aspect ratio.

And check this out: if we go over to States and select hover? We can mess with our radii even further — adding or changing values so things will look different on hover.

If we go back to the None (or normal) state? We can even go down and add a transition: of course, we should select Border Radius — be careful not to select Border because that's a different set of properties.

And on hover? We can see our transition in action.

So. Border Radius. Super powerful. Rounded rectangle. Capsule or pill shape. We can do ellipses. Circles. And of course, we can control individual corners to create all sorts of shapes.

And Border Radius.