Home > Article > Web Front-end > How to Create Rounded Corners for Both the Inside and Border of a Box?
Creating Rounded Corners for Inside of a Box and Its Border
In web design, adding rounded corners to both the inside of a box and its border can enhance the visual appeal of an element.
Calculating Inner Border Radius
To create rounded corners for the inner box, determine the inner border radius. It is calculated as the difference between the outer border radius and the border width:
inner_border_radius = outer_border_radius - border_width
For example, if the outer border radius is 10px and the border width is 5px, the inner border radius would be 5px.
Adjusting CSS Properties
In the CSS code provided, you can remove the vendor-specific background-clip properties (-moz-background-clip and -webkit-background-clip) or set them to border-box to achieve the inner border radius. Additionally, update the inner border radius using the calculation mentioned above.
Code Snippet:
.radius-all { border-radius: 10px; -moz-border-radius: 10px; -webkit-border-radius: 10px; } .template-bg { background: #FFF; } .template-border { border: 5px solid rgba(255, 255, 255, 0.2); }
Additional Considerations:
The above is the detailed content of How to Create Rounded Corners for Both the Inside and Border of a Box?. For more information, please follow other related articles on the PHP Chinese website!