简体   繁体   中英

Center-align one element and right align second element- Tailwind CSS

I have attached a rough idea of what I am trying to achieve, the dotted line represents the center of the container. I am trying to center align one div element, then right align a second div within the same row, while both elements are centered horizontally. 在此处输入图像描述

Try like this:

 <script src="https://cdn.tailwindcss.com"></script> <div class="flex items-center justify-center border border-dashed"> <div class="flex-1"></div> <div class="w-32 h-32 bg-red-500"></div> <div class="flex-1"> <div class="w-20 h-20 bg-green-500 ml-auto"></div> </div> </div>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM