Home >Web Front-end >CSS Tutorial >How to achieve rounded borders with CSS
CSS to achieve rounded borders requires the use of the border-radius property in CSS. Let’s take a look at the details of CSS to implement rounded borders.
Let’s take a look at the implementation code of a border without rounded corners
<div style="border:solid 4px #808080;">这是一个框架</div>
The effect is as follows:
Let’s do it next Let’s look specifically at the code that uses the border-radius attribute in CSS to implement rounded borders.
Let’s first look at the syntax format of the border-radius attribute:
brder-radius:(左上水平半径)(右上水平半径)(右下水平半径)(左下水平半径)/(左上垂直半径)(右上垂直半径)(右下垂直半径)(左下垂直半径);
If / is omitted, it is assumed to be horizontal Have the same radius in both direction and vertical direction.
brder-radius:(左上半径)(右上半径)(右下半径)(左下半径);
Code example 1:
<div style="height:75px; padding-top:25px; border:solid 4px #808080; border-radius: 25px 25px 25px 25px / 25px 25px 25px 25px;">这是一个圆角边框</div>
The effect is as follows:
Code example 2
<div style="height:75px; padding-top:25px; border:solid 4px #808080; border-radius: 100px 100px 1005px 1005px / 25px 25px 25px 25px;">圆角边框</div>
The effect As follows:
Code example 3
<div style="height:75px; padding-top:25px; padding-left:16px; border:solid 4px #808080; border-radius: 50px 20px 20px 20px;">圆角边框</div>
The effect is as follows:
Specify corner radius individually
border-top-left-radius
border-top-righr-radius
border-bottom-left-radius
border-bottom-right-radius
You can also specify the radius of each corner individually. The format is
border-top-left-radius (角的半径)
or
border-top-left-radius (角的水平半径) (角的垂直半径)
The above is the detailed content of How to achieve rounded borders with CSS. For more information, please follow other related articles on the PHP Chinese website!