How to make rounded corner using CSS ?
Last Updated :
21 Jun, 2024
Creating rounded corners is a popular design technique in web development that enhances the visual appeal of web elements. The CSS border-radius property allows you to easily set the radius of an element's corners, making them rounded.
In this article, we will explore how to use the border-radius property with various examples to achieve different rounded corner effects. We'll cover individual corner styling as well as shorthand methods for applying border-radius values efficiently.
Syntax:
/* It sets the radius value to all 4 corners */
border-radius: value;
Example 1: This example describes the border-radius to make the rounded corners.
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content=
"width=device-width, initial-scale=1.0">
<style>
.container {
border: 1px solid black;
width: 300px;
height: 200px;
background-color: aqua;
/* This set radius to all 4 corners */
border-radius: 10px;
}
</style>
</head>
<body>
<h2 style="color:green">GeeksforGeeks</h2>
<div class="container">
<p text-align="center"> Rounded corner</p>
</div>
</body>
</html>
Output:
rounded cornerExample 2: This example describes the use of border-bottom-left-radius property to make a rounded corner at the bottom left.
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport"
content="width=device-width, initial-scale=1.0">
<style>
.container {
border: 1px solid black;
width: 300px;
height: 200px;
background-color: aqua;
border-bottom-left-radius: 30px;
}
</style>
</head>
<body>
<h2>GeeksforGeeks</h2>
<div class="container">
<p text-align="center">
This is Rounded corner at <b>bottom left</b>
</p>
</div>
</body>
</html>
Output:

Example 3: This example describes the use of border-top-right-radius property to make a rounded corner at the top-right corner.
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport"
content="width=device-width, initial-scale=1.0">
<style>
.container {
border: 1px solid black;
width: 300px;
height: 200px;
background-color: aqua;
border-top-right-radius: 30px;
}
</style>
</head>
<body>
<h2>GeeksforGeeks</h2>
<div class="container">
<p text-align="center">
This is Rounded corner at <b>top right</b>
</p>
</div>
</body>
</html>
Output:

Example 4: This example describes the use of border-bottom-right-radius property to make the rounded corner at the bottom right.
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport"
content="width=device-width, initial-scale=1.0">
<style>
.container {
border: 1px solid black;
width: 300px;
height: 200px;
background-color: aqua;
border-bottom-right-radius: 30px;
}
</style>
</head>
<body>
<h2>GeeksforGeeks</h2>
<div class="container">
<p text-align="center">
This is Rounded corner at <b>bottom right</b>
</p>
</div>
</body>
</html>
Output:

Example 5:This example describes the use of border-top-left-radius property to make the corner at the top-left.
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport"
content="width=device-width, initial-scale=1.0">
<style>
.container {
border: 1px solid black;
width: 300px;
height: 200px;
background-color: aqua;
border-top-left-radius: 30px;
}
</style>
</head>
<body>
<h2>GeeksforGeeks</h2>
<div class="container">
<p text-align="center">
This is Rounded corner at <b>top left</b>
</p>
</div>
</body>
</html>
Output:
top left The border-radius property in CSS is a versatile tool for creating visually appealing rounded corners on web elements. This article covered various methods to apply rounded corners, including individual corner properties and shorthand techniques. By You can enhance the design of your web pages, creating a more polished and professional look. Experiment with different radius values to achieve the desired effect and improve the overall web designs.
Similar Reads
How to Make Rounded Image Corners in CSS? Rounded image corners are used to enhance the visual appeal, making images look more smooth and attractive. To make rounded corners on an image, the border-radius property is used. Using border-radius PropertyThe border-radius property in CSS is used to create rounded corners for the image. By setti
1 min read
How to create a Circular/Rounded images using CSS ? In this article, we will create a rounded image with CSS. It can be done by using the CSS border-radius property. This property is mainly used to make round shapes. It contains a numeric value in the form of pixels. Example 1: HTML <!DOCTYPE html> <html> <head> <style> img {
1 min read
How to add rounded corner to an element using CSS ? In this article, we will discuss rounded corners by using CSS properties. When we remove the sharp edge of any element and give it a round shape, it is called a rounded corner. Approach: To change the sharp edge with a rounded edge we use the border-radius property. Example 1: In this example, we na
1 min read
How to Style Round Buttons using CSS? Round buttons are circular buttons used on websites. They usually have icons or text for actions. To style round buttons using CSS, set their width and height equal, use border-radius: 50% for a circular shape, and add colors and hover effects.Add Style To Round Buttons Using CSSMake a basic structu
2 min read
How to Create a Ribbon using CSS? In this article, we will learn how to create a ribbon using CSS.PrerequisitesHTMLCSSApproachThe structure consists of a <button> element with the class "btn" containing the text "GFG DSA Course". Inside the button, there is an <span> element with the class "ribbon" containing the text "N
2 min read