zaster
zaster

Reputation: 171

Tailwind CSS - Grid - Children - Positioning

How can I make the category Horizontally Centered

I tried justify-self-center and it didn't work out

https://play.tailwindcss.com/xTOkLkWyNj

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>

  <body>
    <div class="flex mx-2 space-x-1 h-52 2xl:grid-cols-12 2xl:gap-1 2xl:flex-none">
      <div class="border-black border-2 justify-self-center">
        <label class="font-bold text-center underline">Category</label>
        <select wire:model="category" name="category" class="w-full border-2 border-black">
            <option>test</option>
            <option>test</option>
            <option>test</option>
        </select>
      </div>
    </div>
  </body>
</html>

Upvotes: 0

Views: 690

Answers (1)

A D
A D

Reputation: 466

Please check the below link - https://play.tailwindcss.com/7eFJ0nNXE9

I have added text-center in the div.

<div class="border-black border-2 text-center">
  <label class="font-bold underline">Category</label>
  <select wire:model="category" name="category" class="w-full border-2 border-black">
    <option>test</option>
    <option>test</option>
    <option>test</option>
  </select>
</div>

Upvotes: 1

Related Questions