Home > Article > Web Front-end > How to make css pictures round
In CSS, you can use the border-radius attribute to make the image round. You only need to add the "border-radius: 50%;" style to the img element. The border-radius attribute can set a rounded border to an element. The radius of the rounded corners cannot exceed half the width/height.
The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.
In CSS, you can use the border-radius attribute to make the image round.
Let’s take a closer look at the code example:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <style type="text/css"> img{ border-radius: 50%; } </style> </head> <body> <img src="img/1.jpg" style="max-width:90%" style="max-width:90%"/ alt="How to make css pictures round" > </body> </html>
Rendering:
Description :
border-radius attribute is used to set a rounded border for an element. You can specify a value of 1-4 to create (1~4) rounded corners for the border; the radius of the rounded corners cannot exceed the width. /Half the height.
Syntax:
border-radius: 1-4 length|%
Value:
length Defines the shape of the curve.
% Use % to define the shape of the corners.
Note: The order of the four values for each radius is: upper left corner, upper right corner, lower right corner, lower left corner. If the lower left corner is omitted, the upper right corner is the same. If the lower right corner is omitted, the upper left corner is the same. If the upper right corner is omitted, the upper left corner is the same.
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.
border-radius: 15px 50px 30px 5px
border-radius: 15px 50px 30px
border-radius: 25px
css video tutorial)
The above is the detailed content of How to make css pictures round. For more information, please follow other related articles on the PHP Chinese website!