CSS3 rounded corners
CSS3 Rounded Corners
Using the CSS3 border-radius property, you can make "rounded corners" for any element.
CSS3 border-radius property
Using the CSS3 border-radius property, you can make "rounded corners" for any element.
The following are three examples:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>PHP中文网</title> <style> #rcorners1 { border-radius: 25px; background: #8AC007; padding: 20px; width: 200px; height: 150px; } #rcorners2 { border-radius: 25px; border: 2px solid #8AC007; padding: 20px; width: 200px; height: 150px; } #rcorners3 { border-radius: 25px; background: url(/images/paper.gif); background-position: left top; background-repeat: repeat; padding: 20px; width: 200px; height: 150px; } </style> </head> <body> <p> border-radius 属性允许向元素添加圆角。</p> <p>指定背景颜色元素的圆角:</p> <p id="rcorners1">圆角</p> <p>指定边框元素的圆角:</p> <p id="rcorners2">圆角</p> <p>指定背景图片元素的圆角:</p> <p id="rcorners3">圆角</p> </body> </html>
CSS3 border-radius - specify each rounded corner
If you specify only one value in the border-radius property, then Create 4 fillets.
However, if you want to specify the four corners one by one, you can use the following rules:
Four values: The first value is the upper left corner, the second value is the upper right corner , the third value is the lower right corner, and the fourth value is the lower left corner.
Three values: the first value is the upper left corner, the second value is the upper right corner and the lower left corner, the third value is the lower right corner
Two values: the first value is the upper left corner and the lower right corner, the second value is the upper right corner and the lower left corner
One value: The four rounded corners have the same value
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>PHP中文网</title> <style> #rcorners4 { border-radius: 15px 50px 30px 5px; background: #8AC007; padding: 20px; width: 200px; height: 150px; } #rcorners5 { border-radius: 15px 50px 30px; background: #8AC007; padding: 20px; width: 200px; height: 150px; } #rcorners6 { border-radius: 15px 50px; background: #8AC007; padding: 20px; width: 200px; height: 150px; } </style> </head> <body> <p>四个值 - border-radius: 15px 50px 30px 5px:</p> <p id="rcorners4"></p> <p>三个值 - border-radius: 15px 50px 30px:</p> <p id="rcorners5"></p> <p>两个值 - border-radius: 15px 50px:</p> <p id="rcorners6"></p> </body> </html>
You can also create elliptical corners:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>PHP中文网</title> <style> #rcorners7 { border-radius: 50px/15px; background: #8AC007; padding: 20px; width: 200px; height: 150px; } #rcorners8 { border-radius: 15px/50px; background: #8AC007; padding: 20px; width: 200px; height: 150px; } #rcorners9 { border-radius: 50%; background: #8AC007; padding: 20px; width: 200px; height: 150px; } </style> </head> <body> <p>椭圆边框 - border-radius: 50px/15px:</p> <p id="rcorners7"></p> <p> 椭圆边框 - border-radius: 15px/50px:</p> <p id="rcorners8"></p> <p>椭圆边框 - border-radius: 50%:</p> <p id="rcorners9"></p> </body> </html>
CSS3 Rounded Corner Properties
Properties The abbreviation of the four corner border-*-*-radius properties border-top-left-radius defines the arc of the upper left corner
border-top-right-radius defines the upper right corner The arc