border-radius with Two Values
border-radius with two values is a CSS property allowing customization for the top-left and top-right, or bottom-left and bottom-right corners of an element independently.
Example: In this example, we are giving two values to the border-radius property. The first value is for the top-left corner and bottom-right corner whereas the second value is for the top-right corner and 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 = "index2.css" > < title >CSS border radius</ title > </ head > < body > < div class = "container flex-utility" > < div class = "gfg-heading" >w3wiki</ div > < div > < p class = "text" > First value (top-left and bottom-right corners) </ p > < p class = "text" > Second value (top-right and bottom-left corners) </ p > </ div > < div class = "flex-utility box-items" > < div class = "box box1 two-px-unit flex-utility" > Using px unit </ div > < div class = "box box2 two-p-unit flex-utility" > Using % unit </ div > < div class = "box box3 two-em-unit flex-utility" > Using em unit </ div > < div class = "box box4 two-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: 20px ; 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 ; } .two-px-unit { border-radius: 15px 50px ; background-color : rgb ( 60 , 145 , 79 ); color : beige; border : 2px solid black ; } .two-em-unit { border-radius: 2em 8em ; background-color : rgb ( 60 , 145 , 79 ); border : 2px solid black ; color : beige; } .two-rem-unit { border-radius: 3 rem 5 rem; border : 10px ; background-color : rgb ( 60 , 145 , 79 ); border : 2px solid black ; color : beige; } .two-p-unit { border-radius: 25% 55% ; background-color : rgb ( 60 , 145 , 79 ); border : 2px solid black ; color : beige; } .text { font-size : 25px ; } |
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
Contact Us