laravel 在Tailwind中实现Bootstrap式网格系统

k5hmc34c  于 2022-11-18  发布在  Bootstrap
关注(0)|答案(3)|浏览(188)

我正在使用TailWind与叶片模板在laravel,我如何才能使这些卡像在引导程序,我的意思是每三个项目在一列:

@section('content')
    <div class="flex justify-center">
        <div class="w-8/12 bg-white p-6 rounded-lg mt-10 ">

                    @forelse($products as $product)

                        <!-- Box -->
                            <div class="md:flex md:justify-center md:space-x-8 md:px-14">
                                <!-- box-1 -->
                                <div class="mt-16 py-4 px-4 bg-whit w-72 bg-white rounded-xl shadow-lg hover:shadow-xl transform hover:scale-110 transition duration-500 mx-auto md:mx-0">
                                    <div class="w-sm">
                                        <img class="w-64" src="{{asset('storage/images/products/'.$product->image)}}" alt="" />
                                        <div class="mt-4 text-green-600 text-center">
                                            <h1 class="text-xl font-bold">{{$product->name}}</h1>
                                            <div class="mt-4 text-gray-600">{{$product->info}}</div>
                                            <div class="mt-4 px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-red-300 text-green-800">{{$product->category->name}}</div>
                                            <button class="mt-8 mb-4 py-2 px-14 rounded-full bg-green-600 text-white tracking-widest hover:bg-green-500 transition duration-200">MORE</button>
                                        </div>
                                    </div>
                                </div>
                    @empty
                        <h1 class="text-center">There is no Products</h1>

                    @endforelse

                <div>  {{$products->links()}}</div>
            </div>
    </div>
@endsection
zhte4eai

zhte4eai1#

在Tailwind CSS中重新创建Bootstrap网格系统

<div class="grid grid-cols-12">Your column goes here</div>

您可以点击此链接了解更多详情。https://shortbuzz.in/blog/shortbuzz.in/how-to-create-tailwind-css-grid-system-like-the-bootstrap-grid-system

xurqigkl

xurqigkl2#

下面是Peppermintology的评论的形式的答案:
这听起来像是你在寻找一个3列的网格。要在Tailwind CSS中做到这一点,请使用如下的网格类:

<div class="grid grid-cols-3">
   <!--- Generated cards go here --->
</div>
pbwdgjma

pbwdgjma3#

<div class="container mx-auto">
  <div class="grid grid-cols-12 gap-1">
    <div class="col-span-12 sm:col-span-12 md:col-span-3 lg:col-span-3 xl:col-span-3 2xl:col-span-3">Column</div>
    <div class="col-span-12 sm:col-span-12 md:col-span-3 lg:col-span-3 xl:col-span-3 2xl:col-span-3">Column</div>
    <div class="col-span-12 sm:col-span-12 md:col-span-3 lg:col-span-3 xl:col-span-3 2xl:col-span-3">Column</div>
  </div>
</div>

相关问题