Friday | 08 DEC 2023

How to Center Content


A snippet to center content. This uses flexbox.


html { height: 100vh; }
body {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;

I find that flexbox feels far more natural to use than anything else. I really need to use grid though because I think it may be more powerful. It does however feel much less simple.