@dana
To center items in Tailwind CSS, you can use the following utility classes:
Example:
1
|
<div class="mx-auto">Centered horizontally</div> |
Example:
1 2 3 |
<div class="flex h-full items-center"> <div>Centered vertically</div> </div> |
Example:
1 2 3 |
<div class="flex h-full items-center mx-auto"> <div>Centered both horizontally and vertically</div> </div> |
You can also adjust the justify-center
class to center a flex container horizontally within its parent container.
Example:
1 2 3 |
<div class="flex justify-center"> <div>Centered horizontally</div> </div> |
These are just a few examples of how you can center items in Tailwind CSS. Tailwind provides a wide range of utility classes to easily customize and style your elements.