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 6 months ago

Answers (2)

Add Answer
Umang Ramani Marked As Accepted
Staff answered 4 months 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 6 months ago
<div class="flex h-screen">
  <div class="m-auto">
    <h3>title</h3>
    <button>button</button>
  </div>
</div>

 

Subscribe

Select Categories