I have a .container div just after body that contains everything in page how to center it?

  • emb@lemmy.world
    link
    fedilink
    arrow-up
    2
    ·
    17 days ago

    Not sure what best practice is broadly, but in general display: flex is the first tool I reach for if I need to position child elements a little more carefully.

    It’s good for most things more complex than just margin/padding/text-align. If it gets too complex for flexbox, dig into CSS grid.