CSS circle() function
- Previous Page CSS calc() function
- Next Page CSS clamp() function
- Go to the Previous Level CSS Function Reference Manual
Definition and usage
CSS's circle()
Functions are used to define a circle with a radius and position.
circle()
Functions are usually used with clip-path
Properties and shape-outside
Use the properties together.
Instance
Example 1
Crop the image to a circle with a radius of 50%:
img { clip-path: circle(50%); }
Example 2
Crop the image to a circle with a radius of 50% and position the center to the right:
img { clip-path: circle(50% at right); }
Example 3
Using clip-path
and circle()
To achieve the animation effect:
#myDIV { width: 100px; height: 100px; background-color: coral; color: green; animation: mymove 5s infinite; clip-path: circle(50%); } @keyframes mymove { 50% {clip-path: circle(20%);} }
Example 4
combined use circle()
,clip-path
and shape-outside
:
img { float: left; clip-path: circle(40%); shape-outside: circle(45%); }
CSS syntax
circle(radius at position)
Value | Description |
---|---|
radius |
Required. Specify the radius of the circle. It can be one of the following values:
|
at position |
Optional. Specify the center position of the circle. It can be a length value, a percentage value, or values such as left, right, top, or bottom. The default value is center. |
Technical details
Version: | CSS Shape Module Level 1 |
---|
Browser support
The numbers in the table represent the first browser version to fully support this function.
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
37 | 79 | 54 | 10.1 | 24 |
Related pages
Reference:CSS clip-path property
Reference:CSS shape-outside property
Reference:CSS ellipse() function
Reference:CSS inset() function
Reference:CSS polygon() function
- Previous Page CSS calc() function
- Next Page CSS clamp() function
- Go to the Previous Level CSS Function Reference Manual