Circle() - CSS Function
Summary of characteristics of the circle() function
Computed value: during an animation, the circle() property gradually changes from one value to another.Syntax diagram of circle().
circle() function.Click on the terms of the diagram for more precision.
Download the diagram in SVG.
On the diagram, the terms in bold are the predefined terms in CSS, the others are described below:
ris a positive or zero numerical value, followed by one of CSS dimension units.xandyare numerical values, followed by a unit of dimension.
Description of the circle() function.
The function circle() defines a circle, by indicating its radius, and optionally, its center relative to the element.
This circle can be used in several ways, depending on the property that calls this circle():
- Used with
clip-path, this circle can be used to cut out an element (for making round images, for example). - With
shape-outside, it can be used to define a wrapping shape.
The function
circle()used with the property
clip-pathcuts the following element
into a circle.
The function
circle() used with the property clip-path cuts the following element into a circle.
Parts of the element are hidden.
circle() used with the property shape-outside creates wrapping
around a circle.
The green element is floating. The function
circle() used with the property shape-outside creates wrapping in the shape of a circle.
The circle() value can be used with the following properties:
clip-path: Defines the visible part of the element, delimited by a geometric shape (rectangle, polygon, etc.).offset-path: Defines the path on which an element can be positioned (Motion Path).
shape-outside: Sets the shape of the text outline for a floating element.
Syntaxes of the circle() function.
- clip-path: circle(50px); r
ris the radius of the circle. It is a numerical value, positive or zero, followed by a unit of relative or absolute dimension (see CSS dimension units). Percentages are calculated relative to the largest of the element's dimensions (width or height).ralso accepts the following predefined values:farthest-side: the radius is equal to the distance from the center of the circle to the farthest edge.closest-side: the radius is equal to the distance from the center of the circle to the nearest edge.

Effect of theclosest-sidevalue
Effect of the valuefarthest-sideIf no value is specified, the function
circle()takes the default valueclosest-side. - clip-path: circle(50px at 20% 30%); r x y
xandyare introduced by the wordat. They indicate the coordinates of the center of the circle, measured from the left edge and the top edge of the element.xandyare positive or negative numeric values, followed by a relative or absolute unit of measurement (see CSS dimension units). If they are percentages, these are calculated relative to the width of the element forxand relative to the height of the element fory. Negative values are allowed and position the center of the circle outside the element.xandyalso accept the following predefined values:
-left,centerorrightforx
- andtop,centerorbottomfory.For these two parameters, the default value is
center.
Animation with the circle() function.
Here is a little amusement that mimics the movement of a light spot partially revealing the CSS3 logo. In fact, there are two superimposed images;
the one underneath is heavily darkened, while the one on top is cut out with the clip-path property and the circle() function
whose parameters are animated.

Simulator.
The image below measures 280 pixels in width and 210 pixels in height. Play with the parameters of the function circle() to fully understand
how it works. In particular, test the parameters closest-side and farthest-side.
Browsers compatibility with circle() function.
No compatibility issues have been reported with recent or commonly used browsers.
clip-path, shape-outside, etc.circle() to draw a circle.shapes
circle()function
Browsers on computers :
Mobile browsers :
Outdated or marginal browsers :

Internet Explorer

UC Browser pour Androïd

Opéra Mobile

QQ Browser

Baidu Browser

Opéra

Samsung Internet

Chrome

Safari

Firefox

Safari sur IOS

Edge

Androïd Brower

Firefox pour Androïd

Chrome pour Androïd

KaiOS Browser

Opéra mini
Historic of the circle() function.
-
CSS Shapes Module Level 1
This specification module defines all the predefined shapes usable in CSS: circle, rectangle, ellipse, polygon, complex shapes generated from SVG. It also presents some properties for using these shapes.
Regardingcircle(). Definition of thecircle()function.June 20, 2013Working Draft.March 20, 2014Candidate Recommendation.
See also, in the same standardization module as circle().
The CSS specifications edited by the W3C are organized into modules. circle() is part of CSS Shapes Module.
The following definitions are also described in this same module.
Properties:



Functions:



X and Y coordinates.
clip-path property.



