border-radius Four Values
border-radius with four values defines the radii for the top-left, top-right, bottom-right, and bottom-left corners individually.
Example: In this example, we are giving four values to the border-radius property. The first value is for the top-left corner, the second value is for the top-right corner, the third value is for the bottom-right corner, and the fourth value is for the bottom-left corner.
HTML
<!DOCTYPE html> < html lang = "en" > < head > < meta charset = "UTF-8" > < meta name = "viewport" content=" width = device -width, initial-scale = 1 .0"> < link rel = "stylesheet" href = "val4.css" > < title >CSS border radius</ title > </ head > < body > < div class = "container flex-utility" > < div class = "gfg-heading" > w3wiki </ div > < div class = "flex-utility valuediv" > < p class = "text" > First value (top-left corner) and Second value (top-right corner) </ p > < p class = "text" > Third value (bottom-left corner) and Fourth value (bottom-right corner) </ p > </ div > < div class = "flex-utility box-items" > < div class = "box box1 four-px-unit flex-utility" > Using px unit </ div > < div class = "box box2 four-p-unit flex-utility" > Using % unit </ div > < div class = "box box3 four-em-unit flex-utility" > Using em unit </ div > < div class = "box box4 four-rem-unit flex-utility" > Using rem unit </ div > </ div > </ div > </ body > </ html > |
CSS
/* style.css */ @import url ( 'https://fonts.googleapis.com/css2?family=Poppins&display=swap' ); .flex-utility { display : flex; align-items: center ; justify- content : center ; } .container { height : 100 vh; flex- direction : column; gap: 10px ; font-family : 'Poppins' , sans-serif ; } .box { height : 100px ; width : 200px ; font-size : 20px ; } .box-items { gap: 40px ; flex-wrap: wrap; } .gfg-heading { color : rgb ( 17 , 85 , 17 ); font-size : 50px ; } .four-px-unit { border-radius: 15px 5px 10px 0 ; background-color : rgb ( 60 , 145 , 79 ); color : beige; border : 2px solid black ; } .four-em-unit { border-radius: 2em 4em 6em 8em ; background-color : rgb ( 60 , 145 , 79 ); border : 2px solid black ; color : beige; } .four-rem-unit { border-radius: 3 rem 6 rem 9 rem 12 rem; border : 10px ; background-color : rgb ( 60 , 145 , 79 ); border : 2px solid black ; color : beige; } .four-p-unit { border-radius: 25% 50% 75% 0 ; background-color : rgb ( 60 , 145 , 79 ); border : 2px solid black ; color : beige; } .text { font-size : 25px ; } .valuediv { flex- direction : column; } |
Output:
CSS Rounded Corners
CSS Rounded Corner facilitates the border-radius Property to create corners round for the element. The border-radius Property in CSS is used to define the radius and make corners round from the outer border edge of a specific element. This article will cover all the related aspects of the border-radius Property & understand them with the help of suitable examples.
Table of Content
- CSS border-radius Property
- border-radius with One Value
- border-radius with Two Values
- border-radius with Three Values
- border-radius Four Values
- Other CSS border Property
- border-top-left-radius
- border-top-right-radius
- border-bottom-right-radius
- border-bottom-left- radius