- Services
- Case Studies
- Technologies
- NextJs development
- Flutter development
- NodeJs development
- ReactJs development
- About
- Contact
- Tools
- Blogs
- FAQ
CSS Border-Radius Master Rounded Corners
Discover use cases, options like length, percentage, initial, and inherit.
Enhance your web designs with this versatile property.
Introduction
The CSS border-radius
property is a fantastic tool for web developers and designers. It allows you to round the corners of an element’s outer border, making your designs look smooth and professional. You can control each corner individually or all at once, offering great flexibility.
Description
The CSS border-radius
property helps you round the corners of an element’s border. You can create circular or elliptical corners by setting different radii. This property applies to the entire background of the element, even if there is no border.
Note:
- Doesn’t work with table elements when
border-collapse
is set tocollapse
. - Shorthand for
border-top-left-radius
,border-top-right-radius
,border-bottom-right-radius
, andborder-bottom-left-radius
.
Syntax
The border-radius
property in CSS is used to round the corners of an element’s border. Here’s the basic structure:
Parameters
[1-4 length|%]
: Specify one to four values.- One value: Applies to all corners.
- Two values: First value for top-left and bottom-right, second value for top-right and bottom-left.
- Three values: First for top-left, second for top-right and bottom-left, third for bottom-right.
- Four values: Apply to top-left, top-right, bottom-right, and bottom-left, respectively.
/
: Optional slash to specify additional radii for elliptical corners.initial
: Resets to default value.inherit
: Inherits from the parent element.
Examples
- Single Value:
- Two Values:
- Three Values:
- Four Values:
- Elliptical Corners:
Values
The border-radius
property allows various values for precise control:
Length
- Description: Uses units like
px
,em
, orrem
. - Example:
Percentage (%)
- Description: Relative to the element’s size.
- Example:
Initial
- Description: Resets to default value.
- Example:
Inherit
- Description: Inherits from the parent element.
- Example:
Shorthand Notations
You can use shorthand notations to specify different radii for each corner:
- All Corners:
- Two Values:
- Three Values:
- Four Values:
Elliptical Corners
Specify elliptical corners using a slash (/
):
- Single Elliptical Value:
- Two Elliptical Values:
Examples
Example 1: Rounded Corners for All Sides
Example 2: Rounded Corners with Two Values
Example 3: Rounded Top-Left Corner
Example 4: Elliptical Shape
Example 5: Circular Shape
Example 6: Rounded Top Corners
Example 7: Rounded Bottom Corners
Browser Compatibility
The border-radius
property is widely supported across all major web browsers, making it an essential tool for modern web design and development. Here’s a breakdown of when support for border-radius
was introduced in each browser:
- Google Chrome: Supported since version 5.0 (May 2010)
- Firefox: Supported since version 4.0 (March 2011)
- Internet Explorer/Edge: Supported since version 9.0 (March 2011)
- Opera: Supported since version 10.5 (June 2010)
- Safari: Supported since version 5.0 (June 2010)
Related Properties
The border-radius
property is part of a larger set of CSS properties that control the appearance and behavior of borders in web design. Understanding these related properties can help you achieve more precise and complex designs. Here are some of the key related properties:
1. border-top-left-radius
- Description: This property specifically controls the radius of the top-left corner of an element.
- Syntax:
- Example:
2. border-top-right-radius
- Description: This property specifically controls the radius of the top-right corner of an element.
- Syntax:
- Example:
3. border-bottom-right-radius
- Description: This property specifically controls the radius of the bottom-right corner of an element.
- Syntax:
- Example:
4. border-bottom-left-radius
- Description: This property specifically controls the radius of the bottom-left corner of an element.
- Syntax:
- Example:
5. border-start-start-radius
- Description: This property controls the radius of the starting corner of the element based on the writing direction and text orientation.
- Syntax:
- Example:
6. border-start-end-radius
- Description: This property controls the radius of the ending corner of the element based on the writing direction and text orientation.
- Syntax:
- Example:
7. border-end-start-radius
- Description: This property controls the radius of the starting corner of the element based on the opposite writing direction and text orientation.
- Syntax:
- Example:
8. border-end-end-radius
- Description: This property controls the radius of the ending corner of the element based on the opposite writing direction and text orientation.
- Syntax:
- Example:
9. background-clip
- Description: This property determines whether the background extends into the border or not. It can affect the appearance of
border-radius
. - Syntax:
- Example:
10. border-collapse
- Description: This property is used to collapse the borders of table elements. It affects how the
border-radius
property is applied to table elements. - Syntax:
- Example:
By understanding and utilizing these related properties, you can gain more precise control over the appearance and behavior of borders in your web designs. This allows you to create more complex and visually appealing designs that enhance the user experience.
Talk with CEO
We'll be right here with you every step of the way.
We'll be here, prepared to commence this promising collaboration.
Whether you're curious about features, warranties, or shopping policies, we provide comprehensive answers to assist you.