Skip to main content
CSS Tip

Hexagon shapes with rounded corners

We can create a hexagon shape using clip-path: polygon() but what about the rounded corners variation? It's now possible with the new clip-path: shape(). The code is more complex but you can easily control it using CSS variables.

CSS-only hexagon shape with rounded corners

.hexagon {
--r: 0.15; /* control the radius [0 1] */
--a: 30deg; /* control the rotation */

width: 280px;
aspect-ratio: 1;
clip-path: shape(/* a complex code but all you have to do is to update the above variables */);
}

As a bonus we can animate the radius and also rotate the shape. Here is a demo with a cool hover effect.

See the Pen Rounded hexagon shapes with hover effect by Temani Afif (@t_afif) on CodePen.

⚠️ Chrome-only for now ⚠️


More CSS Tips