To make the corners of a div element rounded, the CSS property border-radius is used. This property allows you to define how rounded the corners should be by specifying a radius.
CSS border-radius Property:
Syntax:
div {
border-radius: 10px;
}
Description: The value can be in pixels (px), percentages (%), or other units. Higher values create more rounded corners.
Example:
Given HTML:
Sample
Given CSS:
div {
width: 100px;
height: 50px;
background-color: red;
border-radius: 10px;
}
References:
MDN Web Docs - border-radius
W3C CSS Backgrounds and Borders Module Level 3
Contribute your Thoughts:
Chosen Answer:
This is a voting comment (?). You can switch to a simple comment. It is better to Upvote an existing comment if you don't have anything to add.
Submit