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

Member

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

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

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by shyann , 6 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.

Related Threads:

How to overlap a div over a div in tailwind css?
How to make css grid items have auto height using tailwind?
How to make two column design responsive using tailwind css?
How to make only placeholder italics in tailwind css?
How to make pseudo line in tailwind css?
How to make white shadows in tailwind css?