The <basicshape>
CSS data type represents a shape used in the clippath
or shapeoutside
properties.
Syntax
The <basicshape>
data type is defined with one of the basic shape functions listed below.
When creating a shape, the reference box is defined by each property that uses <basicshape>
values. The coordinate system for the shape has its origin at the topleft corner of the reference box, with the xaxis running to the right and the yaxis running downwards. All the lengths expressed in percentages are resolved from the used dimensions of the reference box.
Shape functions
The following shapes are supported. All <basicshape>
values use functional notation and are defined here using the value definition syntax.
inset()

inset( <shapearg>{1,4} [round <borderradius>]? )
Defines an inset rectangle.
When all of the first four arguments are supplied they represent the top, right, bottom and left offsets from the reference box inward that define the positions of the edges of the inset rectangle. These arguments follow the syntax of the margin shorthand, that let you set all four insets with one, two or four values.
The optional
<borderradius>
argument(s) define rounded corners for the inset rectangle using the borderradius shorthand syntax.A pair of insets in either dimension that add up to more than the used dimension (such as left and right insets of 75% apiece) define a shape enclosing no area. For this specification, this results in an empty float area.
circle()

circle( [<shaperadius>]? [at <position>]? )
The
<shaperadius>
argument represents r, the radius of the circle. Negative values are invalid. A percentage value here is resolved from the used width and height of the reference box assqrt(width^2+height^2)/sqrt(2)
.The
<position>
argument defines the center of the circle. This defaults to center if omitted. ellipse()

ellipse( [<shaperadius>{2}]? [at <position>]? )
The
<shaperadius>
arguments represent r_{x} and r_{y}, the xaxis and yaxis radii of the ellipse, in that order. Negative values for either radius are invalid. Percentage values here are resolved against the used width (for the r_{x} value) and the used height (for the r_{y} value) of the reference box.The position argument defines the center of the ellipse. This defaults to center if omitted.
polygon()

polygon( [<fillrule>,]? [<shapearg> <shapearg>]# )
<fillrule>
represents the filling rule used to determine the interior of the polygon. Possible values arenonzero
andevenodd
. Default value when omitted isnonzero
.Each pair argument in the list represents x_{i} and y_{i}  the x and y axis coordinates of the i^{th} vertex of the polygon.
The arguments not defined above are defined as follows:
<shapearg> = <length>  <percentage>
<shaperadius> = <length>  <percentage>  closestside  farthestside
Defines a radius for a circle or ellipse. If omitted it defaults to closestside
.
closestside
uses the length from the center of the shape to the closest side of the reference box. For circles, this is the closest side in any dimension. For ellipses, this is the closest side in the radius dimension.
farthestside
uses the length from the center of the shape to the farthest side of the reference box. For circles, this is the farthest side in any dimension. For ellipses, this is the farthest side in the radius dimension.
Computed values of basic shapes
The values in a <basicshape>
function are computed as specified, with these exceptions:
 Omitted values are included and compute to their defaults.
 A
<position>
value incircle()
orellipse()
is computed as a pair of offsets (horizontal then vertical) from the top left origin, each given as a combination of an absolute length and a percentage.  A
<borderradius>
value ininset()
is computed as an expanded list of all eight<length>
or percentage values.
Interpolation of basic shapes
When animating between one <basicshape>
and another, the rules below are applied. The values in the shape functions interpolate as a simple list. The list values interpolate as <length>
, <percentage>
, or calc()
where possible. If list values are not one of those types but are identical (such as finding nonzero
in the same list position in both lists), those values do interpolate.
 Both shapes must use the same reference box.
 If both shapes are the same type, that type is
ellipse()
orcircle()
, and none of the radii use theclosestside
orfarthestside
keywords, interpolate between each value in the shape functions.  If both shapes are of type
inset()
, interpolate between each value in the shape functions.  If both shapes are of type
polygon()
, both polygons have the same number of vertices, and use the same<fillrule>
, interpolate between each value in the shape functions.  In all other cases no interpolation occurs.
Examples
Animated polygon
HTML
<div></div>
CSS
div { width: 300px; height: 300px; background: lineargradient(red, blue); webkitclippath: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%); clippath: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%); animation: 5s poly infinite alternate easeinout; margin: 1em auto; display: block; } @keyframes poly { from { webkitclippath: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%); clippath: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%); } to { webkitclippath: polygon(44% 26%, 58% 38%, 58% 38%, 44% 81%, 44% 81%, 25% 49%); clippath: polygon(44% 26%, 58% 38%, 58% 38%, 44% 81%, 44% 81%, 25% 49%); } }
Result
Specifications
Specification  Status  Comment 

CSS Shapes Module Level 1 The definition of '<basicshape>' in that specification. 
Candidate Recommendation  Initial definition. 
Browser Compatibility
Feature  Chrome  Edge  Firefox  Internet Explorer  Opera  Safari 

Basic support  Yes  ?  47  No  Yes  Yes webkit 
inset()  ?  ?  No  No  No  ? 
Animation  Yes  ?  49  No  Yes  Yes 
Feature  Android webview  Chrome for Android  Edge mobile  Firefox for Android  Opera Android  iOS Safari  Samsung Internet 

Basic support  Yes  Yes  ?  47  No  Yes  ? 
inset()  ?  Yes  ?  No  No  ?  ? 
Animation  ?  ?  ?  49  No  ?  ? 
See also
 Properties that use this data type:
clippath
,shapeoutside