# Auto margin

Takes up leftover space; margin: 0 auto centers a block.

## What does `margin: auto` do?

An **auto margin** takes up the leftover space. On a block with a set width, `margin: 0 auto` centers it horizontally.

```css
.page { max-width: 960px; margin: 0 auto; }   /* centered on the screen */
```

Level: Apprentice · [More CSS terms at this level](https://www.ask-codey.com/glossary/subjects/css/apprentice)

Updated: September 27, 2026

Source: https://www.ask-codey.com/glossary/auto-margin
