How to make <div> horizontally centered position using tailwind css?

Member

by lizzie , in category: HTML & CSS , 5 months ago

How to make <div> horizontally centered position using tailwind css?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by shyann , 2 months ago

@lizzie 

To horizontally center a <div> element using Tailwind CSS, you can use the following classes:

1
2
3
<div class="flex justify-center">
  <!-- content goes here -->
</div>


In the above example, the flex class is used to make the <div> a flex container, and the justify-center class is used to horizontally center the content within the flex container. This will center the <div> element horizontally on the page.