Home >Web Front-end >CSS Tutorial >How to achieve rounded corners of images in css
How to implement rounded corners in images with css: First create an HTML sample file; then create a div element; and finally add rounded corners to the element through the "border-radius" attribute of css3.
The operating environment of this tutorial: Windows7 system, HTML5&&CSS3 version. This method is suitable for all brands of computers.
Recommended: "css video tutorial"
CSS rounded corners
css2.1 Add a circle to an element Corners are a very troublesome thing. The old method is to use background images, which is more troublesome to produce. css3, the border-radius attribute enables the rounded corner attribute to be perfectly solved.
Syntax
border-radius: length value;
Description:
The length value can be px, percentage, em, etc.
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>圆角实现</title> <style type="text/css"> div{ width: 100px; height: 50px; border-radius: 10px; background-color: yellow; } </style> </head> <body> <div></div> </body> </html>
Set border-radius:10px; the four set corner radiuses are all 10px
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>圆角实现</title> <style type="text/css"> img{ width: 300px; border-radius:80% 90% 100% 20%; } </style> </head> <body> <img src="1.jpg" / alt="How to achieve rounded corners of images in css" > </body> </html>
The above is the detailed content of How to achieve rounded corners of images in css. For more information, please follow other related articles on the PHP Chinese website!