FIND YOUR NEXT FEW LINES
Results for “margin”
Small, practical examples. Search by task or narrow things down below.
6 snippets foundClear filters
Center a fixed-size absolute child with auto margins
CSS: An all-zero inset plus auto margins distributes the available space around the child.
CSS✓ Tested
Add space outside an element
CSS: Learn how to add space outside an element in a complete browser example.
CSS✓ Tested
Leave room above a scrolled-to heading
CSS: Scroll-margin offsets scrollIntoView placement so a heading is not flush against the viewport edge.
CSS✓ Tested
Push one flex item away from its siblings
CSS: An auto inline-start margin consumes remaining main-axis space.
CSS✓ Tested
Constrain and center a container
Use max-width and auto margins for a centered CSS reading area.
CSS✓ Tested
Space items with gap
Use CSS gap instead of margins between flex children.
CSS✓ Tested