How to center a div in tailwindcss

Using grid and flex, we'll center a div element horizontally and vertically on a page.

<!-- by grid -->
<div class="grid place-items-center h-screen">
  Centered using Tailwind.
</div>

<!-- by flex -->
<div class="flex justify-center items-center h-screen">
  Centered using Tailwind.
</div>