How to align the center in Flexbox

Flexbox has become my favorite way to center elements on the page.

You pack your items indivAnd then you setdisplay: flexwithjustify-content: center.

<div class="wrapper">
  ...
</div>
.wrapper {
  display: flex;
  justify-content: center;
}

It’s easier to use Tailwind CSS, all you have to do is addflexwithjustify-centerclass:

<div class="flex justify-center">
   ...
</div>

Download mine for freeCSS Manual


More CSS tutorials: