How to make div content center both vertically and horizontally in Tailwind?

Forums CSSHow to make div content center both vertically and horizontally in Tailwind?
Staff asked 2 years ago

Answers (2)

Add Answer
Umang Ramani Marked As Accepted
Staff answered 2 years ago

We’ll start by using grid center to make a div element horizontally and vertically centered on a page.

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

 

Staff answered 2 years ago
<div class="flex h-screen">
  <div class="m-auto">
    <h3>title</h3>
    <button>button</button>
  </div>
</div>

 

Subscribe

Select Categories