▲ 7 ▼ How to center the whole website? (lemdro.id) submitted 10 months ago by claim_arguably@lemdro.id to c/css@programming.dev 9 comments fedilink hide all child comments I have a .container div just after body that contains everything in page how to center it?
[–] emb@lemmy.world 2 points 10 months ago (3 children) Check out Flexbox! permalink fedilink source parent hideshow 3 child comments replies: [–] claim_arguably@lemdro.id [S] 2 points 10 months ago (2 children) Is it a good idea to make body a flexbox? Is there any standards for doing this? permalink fedilink source parent hideshow 2 child comments replies: [–] brian@programming.dev 3 points 10 months ago there are more aggressive css "resets" that set the default display type to flex. there's no problem making anything a flexbox if it displays the way you want it to permalink fedilink source parent [–] emb@lemmy.world 2 points 10 months 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. permalink fedilink source parent
[–] claim_arguably@lemdro.id [S] 2 points 10 months ago (2 children) Is it a good idea to make body a flexbox? Is there any standards for doing this? permalink fedilink source parent hideshow 2 child comments replies: [–] brian@programming.dev 3 points 10 months ago there are more aggressive css "resets" that set the default display type to flex. there's no problem making anything a flexbox if it displays the way you want it to permalink fedilink source parent [–] emb@lemmy.world 2 points 10 months 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. permalink fedilink source parent
[–] brian@programming.dev 3 points 10 months ago there are more aggressive css "resets" that set the default display type to flex. there's no problem making anything a flexbox if it displays the way you want it to permalink fedilink source parent
[–] emb@lemmy.world 2 points 10 months 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. permalink fedilink source parent