margin-trim
Limited availability71% of usersExperimental
An experimental property that 'trims' the margins of child elements when they hit the edges of their container. It's a cleaner way to handle things like the last item's margin-bottom.
What's modern
From web-features, MDN's browser data and our snippets, checked dailyComingNot in Firefox yet, so not every major browser supports it.
See how modern your own CSS is.Check your CSS →
Quick facts
- Initial value
none- Inherited
- No
- Applies to
- block containers and multi-column containers
- Animation type
- discrete
Quick example
.container {
/* Automatically removes bottom margin from the last child */
margin-trim: block-end;
}Values
nonein-flowallmargin-trim 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.
Usage71%of people can use this29% use a browser without it.
Browsers
155+
16.4+
155+Mobile
155+Android
16.4+iOS