如何在Tailwind v2网格中实现类似Tailwind v3的大图片尺寸
问题说明
因Tailwind v3在iPhone 6上存在兼容性问题,我目前使用Tailwind v2进行开发,需要在Tailwind v2的网格布局中实现与Tailwind v3完全一致的大图片尺寸效果。现有对应Tailwind v2和v3的测试站点各一个。
Tailwind v2 代码示例
<html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width-device-width, initial-scale=1.0"> <link href='https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css' rel='stylesheet'> </head> <body> <section class="px-3 py-5 bg-neutral-100 lg:py-10"> <div class="grid lg:grid-cols-2 items-center justify-items-center gap-5"> <div class="order-2 lg:order-1 flex flex-col justify-center items-center"> <p class="text-4xl font-bold md:text-7xl text-orange-600">25% OFF</p> <p class="text-4xl font-bold md:text-7xl">SUMMER SALE</p> <p class="mt-2 text-sm md:text-lg">For limited time only!</p> </div> <div class="order-1 lg:order-2"> <img src="https://images.unsplash.com/photo-1615397349754-cfa2066a298e?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1887&q=80" class="w-80 h-80 object-cover lg:w-[500px] lg:h-[500px]"> </div> </div> </section> </body> </html>
Tailwind v3 代码示例(仅CDN链接不同)
<html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width-device-width, initial-scale=1.0"> <script src="https://cdn.tailwindcss.com"></script> </head> <body> <section class="px-3 py-5 bg-neutral-100 lg:py-10"> <div class="grid lg:grid-cols-2 items-center justify-items-center gap-5"> <div class="order-2 lg:order-1 flex flex-col justify-center items-center"> <p class="text-4xl font-bold md:text-7xl text-orange-600">25% OFF</p> <p class="text-4xl font-bold md:text-7xl">SUMMER SALE</p> <p class="mt-2 text-sm md:text-lg">For limited time only!</p> </div> <div class="order-1 lg:order-2"> <img src="https://images.unsplash.com/photo-1615397349754-cfa2066a298e?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1887&q=80" class="w-80 h-80 object-cover lg:w-[500px] lg:h-[500px]"> </div> </div> </section> </body> </html>
内容的提问来源于stack exchange,提问作者user310291
相关产品推荐
相关产品推荐

