Allow overflow when centered element goes off screen
On my website https://xansnh.neocities.org/(similarly with https://xan.nekoweb.org/) everything is centered with a flexbox, but the contents change size to always fit the screen, which doesn't really work for smaller viewports. Or, they might go slightly off screen (above/below), even with a scrollbar. But subpages on my main website, for example https://xan.lol/#now, all the contents are surrounded by
display: block
display: block
elements with margin. How can I achieve that kind of margin, but still keep contents centered without scrollbars when they wouldn't normally go off screen or exceed some percentage of the view-height?