CSS ellipse() function
- Previous Page CSS drop-shadow() function
- Next Page CSS exp() function
- Go to the Previous Level CSS Function Reference Manual
Definition and usage
CSS's ellipse()
Functions define an ellipse with two radii x and y.
ellipse()
Functions usually work with clip-path
Properties and shape-outside
Used together.
Instance
Example 1
Crops the image into an ellipse with an x radius of 50% and a y radius of 30%:
img { clip-path: ellipse(50% 30%); }
Example 2
Crops the image into an ellipse with an x radius of 50% and a y radius of 30%, and positions the center of the ellipse to the right:
img { clip-path: ellipse(50% 30% at right); }
Example 3
Using clip-path
and ellipse()
To achieve the animation effect:
#myDIV { width: 100px; height: 100px; background-color: coral; color: green; animation: mymove 5s infinite; clip-path: ellipse(80% 50%); } @keyframes mymove { 50% {clip-path: ellipse(30% 10%);} }
Example 4
combined use ellipse()
,clip-path
and shape-outside
:
img { float: left; clip-path: ellipse(50% 30%); shape-outside: ellipse(55% 35%); }
CSS syntax
ellipse(xy-radius at position)
Value | Description |
---|---|
xy-radius |
Required. Specify two radii x and y. The following values can be used:
|
at position |
Optional. Specify the center position of the ellipse. 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 attribute
Reference:CSS circle() function
Reference:CSS inset() function
Reference:CSS polygon() function
- Previous Page CSS drop-shadow() function
- Next Page CSS exp() function
- Go to the Previous Level CSS Function Reference Manual