LESSON 5.2
CSS Border Radius
Round your corners for a modern, polished look
Learn how the border-radius property lets you soften the corners of any element, from subtly rounded buttons to perfect circles.
๐ก The Concept
CSS border radius is what gives elements rounded corners โ one of the most commonly used visual effects in modern web design. The border-radius property rounds the corners of an element’s border. Lower values give subtle rounding; higher values create more dramatic curves. Many designers choose one border-radius value and apply it consistently across their site for a uniform look.

Basic Usage
img {
border: 3px solid #333;
border-radius: 10px;
}
Shorthand: Different Values Per Corner
Like padding, border-radius has a shorthand for setting each corner individually. The values go clockwise from the top-left: top-left, top-right, bottom-right, bottom-left.
button {
border-radius: 15px 30px 100px 5px;
}

Making a Circle
Setting border-radius: 50% on a square element turns it into a perfect circle. This is widely used for profile photos and avatars:
img {
border: 3px solid #333;
border-radius: 50%;
width: 200px;
height: 200px;
}
๐ฌ Video Demonstration
In the video below I demonstrate how to set a border radius. If you have a square element you can make it round with border-radius: 50%.
Exercise: Try It Yourself
Step 1. Open JSFiddle and paste this HTML into the HTML panel:
<h1>Border Play</h1>
<img src="https://webdevstudents.com/wp-content/uploads/2025/09/guinea-pig.png" alt="A cute guinea pig" width="100" height="100">
Step 2. In the CSS panel, add a border-radius to the image. If you need help choosing values, use the Border Generator to experiment and copy the CSS.
Step 3. Make the image a circle with border-radius: 50%.
Step 4. Use the shorthand to set a different radius on each corner.

๐ Tools of the Trade: The Border Generator lets you experiment with border-radius values visually and copy the CSS. Bookmark the Tools of the Trade page for quick access to all course tools.
Frequently Asked Questions
Yes. border-radius rounds the corners of the element itself โ its background, outline, and any border it has. You don’t need a border property at all. Many designers use border-radius on images and cards with no border.
Pixel values give a fixed curve size no matter how large or small the element is. Percentage values are relative to the element’s dimensions โ which is why border-radius: 50% on a square always creates a perfect circle.
It only creates a circle when the element is square (equal width and height). On a rectangle, border-radius: 50% creates an ellipse instead. Set explicit equal width and height values to guarantee a circle.
Yes. Use the individual properties: border-top-left-radius, border-top-right-radius, border-bottom-right-radius, and border-bottom-left-radius. Or use the four-value shorthand to set each corner in one line.
Clockwise starting from the top-left corner: top-left, top-right, bottom-right, bottom-left. This is the same order used by padding and margin shorthand.
Absolutely โ it’s one of the most common uses. A small value like 4px gives a subtle rounded look; a large value like 50px on a short button creates a “pill” shape. Many design systems pick one border-radius value and apply it to all buttons for a consistent style.
Sometimes. If you apply border-radius to a container and the content inside (like an image) spills out past the rounded corners, add overflow: hidden to the container. This clips the content to the rounded shape.
border-radius works by placing an imaginary circle in each corner โ the value you set is the radius of that circle. The corner of your element follows the curve of that circleโs edge. A small value like 4px places a tiny circle there (barely noticeable rounding); a larger value places a bigger circle (more dramatic curve). With border-radius: 50% on a square element, the circle in each corner is exactly half the elementโs size, so all four arcs meet perfectly in the middle and form a complete circle. On a rectangle, the width and height are different, so 50% gives you an ellipse instead.
โ Key Takeaways
Rounded corners are a staple of modern web design. This lesson showed you how to use the border-radius property to create rounded shapes, pill buttons, and even perfect circles. Next, you will learn how to use CSS gradients to create smooth color transitions for backgrounds and design elements.
Google Ads
The costs of this website are partially offset by revenue from Google Ads.Tools of the Trade
HTML/CSS Lessons
-
-
-
1.3. HTML Tag Preview
-
-
-
2.2. The HTML Framework
-
-
2.4. HTML Headings
-
-
-
-
-
-
3.01. Introduction to CSS
-
3.02. How CSS Cascades
-
-
-
-
3.05. CSS Colors
-
3.06. RGBA Colors
-
-
3.08. Font and Text Properties
-
3.09. Classes and IDs
-
-
-
-
-
4.3. HTML Embedded Images
-
-
-
-
-
-
5.1. CSS Borders
-
5.2. CSS Border Radius
-
5.3. CSS Gradients
-
5.4. CSS Box Shadows
-
5.5. CSS Text Shadows
-
7.1. The Display Property
-
-
-
7.4. The Box Model
-
-
-
-
-
-
9.1. Website Tables
-
9.2. HTML Forms
-
-
9.4. Special Form Fields
-
9.5. Embedding Multimedia
-
-
9.7. Keyboard Shortcuts
-
10.1. What Is a Framework?
-
10.2. Font Awesome Icons
-
-
10.4. Bootstrap Grid System
-
-
10.6. Bootstrap Navigation
-
-
11.2. Purchasing a Domain Name
-
11.3. Website Hosting
-
11.4. Nameservers and DNS
-
11.5. FTP
-
11.6. GitHub Pages
