Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Selected Reading
Set top-left corner border with CSS
The CSS border-top-left-radius property is used to set a rounded border specifically for the top-left corner of an element. This property allows you to create asymmetric rounded corners where only the top-left corner has a different radius than other corners.
Syntax
selector {
border-top-left-radius: value;
}
Possible Values
| Value | Description |
|---|---|
length |
Defines the radius in px, em, rem, etc. |
% |
Defines the radius as a percentage of the element's dimensions |
initial |
Sets the property to its default value |
inherit |
Inherits the value from the parent element |
Example
The following example demonstrates how to set a larger border radius for the top-left corner while keeping other corners with a smaller radius −
<!DOCTYPE html>
<html>
<head>
<style>
#rcorner {
border-radius: 25px;
border-top-left-radius: 45px;
background: #FADBD8;
padding: 20px;
width: 300px;
height: 150px;
color: #333;
font-family: Arial, sans-serif;
}
</style>
</head>
<body>
<p id="rcorner">Rounded top-left corner!</p>
</body>
</html>
A light pink rectangular box with rounded corners appears. The top-left corner has a more pronounced 45px radius curve, while the other three corners have a smaller 25px radius curve.
Conclusion
The border-top-left-radius property provides precise control over individual corner styling. It's particularly useful for creating unique designs where you need asymmetric corner treatments on elements.
Advertisements
