border-shape
Limited availability68% of usersExperimental
Gives an element's border any basic shape, like circle(), polygon() or path(). With one shape, the border is drawn as a line along it, as thick as the border width. With two shapes, the border fills the space between them. It switches off border-radius and corner-shape on that element and doesn't change layout. It works in Chrome and Edge 147 and later so far.
What's modern
From web-features, MDN's browser data and our snippets, checked dailyComingNot in Firefox or Safari yet, so not every major browser supports it.
The old way and the modern waySee the snippet: Custom border shapes without clip-path hacks →
Old way 7 lines
.tooltip {
background: var(--accent);
padding: 1rem;
padding-block-end: calc(1rem + 12px);
clip-path: polygon(0 0, 100% 0, 100% calc(100% - 12px), 60% calc(100% - 12px), 50% 100%, 40% calc(100% - 12px), 0 calc(100% - 12px));
}
/* clip-path masks the visual but the box is still rectangular for layout, shadows, and outlines */Modern 7 lines
.tooltip {
border-shape: shape(from 0 0, hline to 100%, vline to calc(100% - 12px), line to 60% calc(100% - 12px), line to 50% 100%, line to 40% calc(100% - 12px), line to 0 calc(100% - 12px), close);
background: var(--accent);
padding: 1rem;
padding-block-end: calc(1rem + 12px);
}
/* the box itself is the shape, no clip-path needed */See how modern your own CSS is.Check your CSS →
Quick facts
- Initial value
none- Inherited
- No
- Applies to
- all elements
- Animation type
- byComputedValueType
Quick example
.avatar {
width: 120px;
height: 120px;
border: 6px solid rebeccapurple;
border-shape: circle(50%);
}
.diamond {
width: 200px;
height: 200px;
border: 10px solid crimson;
border-shape:
polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%)
polygon(50% 10%, 90% 50%, 50% 90%, 10% 50%);
}Values
none<basic-shape><geometry-box>Related snippet
Custom border shapes without clip-path hacksLayout →border-shape browser support
BaselineLimited availabilityThis feature is not Baseline because it does not work in some of the most widely-used browsers.Not ready for production without a fallback.
Usage68%of people can use this32% use a browser without it.
Browsers
147+
147+Mobile
147+Android