Thanks to visit codestin.com
Credit goes to www.cssportal.com

CSS Portal

circle() CSS Function

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!

Description

The circle() CSS function is used to define a circular shape that can be applied to elements, allowing you to mask or clip the visible portion of an element in a perfect circle. It is part of the broader set of shape functions, which let you create complex shapes such as polygons, ellipses, and insets.

When using circle(), you specify the radius of the circle and its center point. The radius can be defined using absolute units like pixels or relative units such as percentages. The center point determines where the circle is positioned inside the element, and by default, it is centered at the midpoint of the element.

For example, using circle(50% at 50% 50%) creates a circle with a radius equal to half the smallest dimension of the element, perfectly centered. If you wanted a smaller circle positioned toward the top-left corner, you might use circle(30% at 20% 20%).

This function works particularly well with overflow hidden elements, images, and div containers, allowing designers to create circular avatars, buttons, or masked image effects without editing the image itself. It also pairs nicely with transition or animation properties to animate the circle's size or position for interactive effects.

An example usage could be:

.avatar {
  clip-path: circle(40% at 50% 50%);
  transition: clip-path 0.3s ease-in-out;
}
.avatar:hover {
  clip-path: circle(50% at 50% 50%);
}

This creates a circular mask on an element that grows slightly when hovered over, providing a smooth, dynamic visual effect.

The circle() function is widely supported in modern browsers and is a lightweight way to achieve circular clipping without additional images or SVGs.

Syntax

circle() = circle( <shape-radius>? [ at <position> ]? ) 

Values

  • shape-radiusspecifies the radius of the circle. It can be set in absolute lengths or percentages. A percentage value here is resolved from the used width and height of the reference box. Negative values are not allowed.
  • positionThe position argument defines the center of the circle. This defaults to center if omitted.

Example

<div class="circle-box"></div>
.circle-box {
width: 300px;
height: 300px;
background-color: #3498db;

/* circle(radius at x-axis y-axis) */
clip-path: circle(50% at 50% 50%);

/* Transition for a smooth hover effect */
transition: clip-path 0.4s ease-in-out;
}

.circle-box:hover {
/* Shrinks the circle to 30% radius on hover */
clip-path: circle(30% at 50% 50%);
}

Browser Support

The following information will show you the current browser support for the CSS circle() function. Hover over a browser icon to see the version that first introduced support for this CSS function.

This function is supported by all modern browsers.
Desktop
Chrome
Edge
Firefox
Opera
Safari
Tablets & Mobile
Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-

Last updated by CSSPortal on: 31st December 2025

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!