property
Margin trim — CSS reference
Requests trimming of eligible margins at container edges, such as first and last child margins along the block axis. It is not a general reset of every child margin. For a simple block stack, first/last-child margin overrides can provide a fallback but do not cover every formatting context.
Formal Syntax & Structure
css syntaxcss
margin-trim: block;Working Example
Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>margin-trim</title><style>body{margin:8px;font:16px/24px sans-serif}#a{display:flow-root;margin-trim:block;width:180px}#a p{margin:12px 0;height:20px}#a p:first-child{margin-block-start:0}#a p:last-child{margin-block-end:0}</style><body><div id="a"><p>One</p><p>Two</p></div></body></html>