Quick CSS layout question.
.parent {
display: flex;
justify-content: center;
align-items: center;
}
.child {
margin-left: auto;
}
Why does the child not stay centered, and what is the simplest fix.
WaffleFries
Quick CSS layout question.
.parent {
display: flex;
justify-content: center;
align-items: center;
}
.child {
margin-left: auto;
}
Why does the child not stay centered, and what is the simplest fix.
WaffleFries
margin-left: auto takes the free space and pushes the child to the right, so remove that if you want true flex centering.
.parent { display: flex; justify-content: center; align-items: center; }
.child { margin-left: 0; }
BobaMilk
:: Copyright KIRUPA 2024 //--