shape-margin
Widely availableSince 202097% of users
Sets a margin for a shape created with 'shape-outside'. It adds a buffer of empty space between the custom shape and the text wrapping around it.
What's modern
From web-features, MDN's browser data and our snippets, checked dailyModernIn every major browser since January 2020. Widely available since July 2022.
The old way and the modern waySee the snippet: Wrap text around shapes without dummy floats →
Old way 7 lines
.avatar {
float: left;
width: 160px;
height: 160px;
border-radius: 50%;
}
/* looks round, wrap is still a rectangle */Modern 6 lines
.avatar {
float: left;
shape-outside: circle(50%);
shape-margin: 1rem;
}
/* wrap follows the circle, not the box */See how modern your own CSS is.Check your CSS →
Quick facts
- Initial value
0- Inherited
- No
- Applies to
- floats
- Animation type
- lpc
Quick example
.circle-wrap {
float: left;
shape-outside: circle(50%);
/* Pushes the text 20px away from the curve of the circle */
shape-margin: 20px;
}shape-margin browser support
BaselineWidely availableThis feature is well established and works across many devices and browser versions. It has been available across browsers since 2020.Safe to use without fallbacks.
Usage97%of people can use this3% use a browser without it.
Browsers
37+
62+
10.1+
79+Mobile
37+Android
62+Android
10.3+iOS