Home>Article>Web Front-end> How to set a picture to a circular picture in css

How to set a picture to a circular picture in css

王林
王林 Original
2021-03-01 16:28:13 11217browse

How to set a circular picture in css: You can use the border-radius attribute to set a circular picture, with code such as [border-radius:50%]. The border-radius property allows us to add rounded borders to elements.

How to set a picture to a circular picture in css

The operating environment of this article: windows10 system, css 3, thinkpad t480 computer.

Attribute introduction:

The border-radius attribute allows us to add a rounded border to an element.

Syntax:

border-radius: 1-4 length|% / 1-4 length|%;

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.

Attribute value:

  • length defines the shape of the curve.

  • % Use % to define the shape of the corners.

The specific implementation code is as follows:

(Learning video sharing:css video tutorial)

style{ .circle{ width:120px; height:120px; border-radius:50%; overflow:hidden; } .circle > img{ width: 100%; height: 100%; } } 
正方形的原始图片

Related recommendations:CSStutorial

The above is the detailed content of How to set a picture to a circular picture in css. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn