Hello guys, I am Nam and this is my personal blog about my work, my life. Outside of work, I do something about UI, UX, DevOps, mobile...
.parent {
display: flex;
justify-content: center;
align-items: center;
}
.parent {
display: grid;
place-content: center;
}
.parent {
position: relative;
}
.child {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.parent {
display: flex;
}
.child {
margin: auto;
}
.parent {
display: grid;
}
.child {
margin: auto;
}
I think the best way to center a div is #1 and the easiest is #2, hope you like that 😄.