Tailwind css:对齐父div的元素底部

ren*_*thy 4 html css tailwind-css

在此输入图像描述

<div class="grid grid-cols-5 gap-4">
  <div class="overflow-hidden border hover:rounded-lg hover:shadow-lg justify-evenly">
                <div class="flex px-3 pt-1 justify-end">
                  <a class="underline italic" href="desc.html" title="Description">More</a>
                </div>
                <a class="cursor-pointer" href="www.www.com">
                  <img src="img/img.JPG" />
                </a>
                <div class="flex w-full justify-evenly mt-1 mb-4">
                  <a href="www.www.com class="bg-green-700 hover:bg-green-800 text-white font-bold py-1 px-4 rounded">
                    Button
                  </a>
                </div>
              </div>
  <div class="overflow-hidden border hover:rounded-lg hover:shadow-lg justify-evenly">

  </div>
  ...

</div>
Run Code Online (Sandbox Code Playgroud)

我有带有多个网格单元的网格。每个单元格都包含图像。在图像下方有一个按钮。当前按钮位于图像正下方。然而,图像的高度不同。所以这些按钮没有对齐。我想知道如何将这些按钮放在每个单元格的底部?

我尝试添加align-bottom按钮包装,但没有帮助。

Dig*_*jay 7

只需要玩玩h-# flex flex-col justify-*。查看工作演示

<div class="grid grid-cols-3">
  <div class="col-span-1 h-96 flex flex-col justify-between">
    <img src="https://homepages.cae.wisc.edu/~ece533/images/airplane.png" class="h-full bg-cover bg-center" />
    <button class="w-24 px-4 py-2 bg-gray-200 rounded-lg">Button</button>
  </div>
  <div class="col-span-1 h-96 flex flex-col justify-between">
    <img src="https://homepages.cae.wisc.edu/~ece533/images/arctichare.png" class="h-3/5 bg-cover bg-center" />
    <button class="w-24 px-4 py-2 bg-gray-200 rounded-lg">Button</button>
  </div>
  <div class="col-span-1 h-96 flex flex-col justify-between">
    <img src="https://homepages.cae.wisc.edu/~ece533/images/baboon.png" class="h-3/4 bg-cover bg-center" />
    <button class="w-24 px-4 py-2 bg-gray-200 rounded-lg">Button</button>
  </div>
</div>

Run Code Online (Sandbox Code Playgroud)