[英]Tailwind a max of two flex items per row
I've the following items:我有以下项目:
const items = ['2342', 'Jensen Huang', 'jensen@gmail.com', '$ 200', 'delivered','29 Aug 2022', 'View All of the items']
And it is rendered as such (it's like flex-auto):它是这样呈现的(就像 flex-auto):
<div class="border flex flex-wrap gap-4 justify-between">
{items.map((item) => <p>{item}</p>)}
</div>
It gives the following它给出了以下内容
+-----------------------------------------+
|2342 Jensen Huang jensen@gmail.com|
|$ 200 delivered 29 Aug 2022|
|View All of the items |
+-----------------------------------------+
but I want a maximum of two elements per row;但我希望每行最多两个元素; like this:
像这样:
+--------------------------------+
|2342 Jensen Huang|
|jensen@gmail.com $ 200|
|delivered 29 Aug 2022|
|View All of the items |
+--------------------------------+
Use grid
and grid-cols-2
.使用
grid
和grid-cols-2
。
<div class="border grid grid-cols-2 gap-4 justify-between">
{items.map((item) => <p>{item}</p>)}
</div>
I think something like this might be what you want?我想这样的事情可能是你想要的?
<div class="border flex flex-wrap gap-4 justify-between">
<div>
<p>2342</p>
<p>jensen@gmail.com</p>
<p>delivered</p>
<p>View All of the items</p>
</div>
<div>
<p>Jensen Huang</p>
<p>₹ 200</p>
<p>29 Aug 2022</p>
</div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.