All tips

Center a div with 3 lines of CSS

CSS1 min · January 15, 2024

Use flexbox for perfect centering without the hassle.

.center {
  display: flex;
  justify-content: center;
  align-items: center;
}