Not the first time I'm having this problem. This time I will document my solution for future reference.
The goal is to have root container (usually the #root container of the page), which centers its child element when the child is small enough to fit on the page. Otherwise, the container employs vertical scrollbar.
TL;DR: add margin: auto;
on the child.