html, body { height: 100%; margin: 0; } #wrapper { min-height: calc(100% - 2em); display: grid; grid-template-rows: auto 1fr auto; row-gap: 1em; padding: 1em; }