源代码:
下载代码
AI 编程工具
点击运行
<!doctype html> <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> <div class="relative rounded-xl overflow-auto p-8"> <p>使用 flex-nowrap</p> <div class="flex flex-nowrap gap-4 font-mono text-white text-sm font-bold leading-6 bg-stripes-sky rounded-lg"> <div class="w-2/5 flex-none last:pr-8"> <div class="p-4 w-full rounded-lg flex items-center justify-center bg-sky-500 shadow-lg">01</div> </div> <div class="w-2/5 flex-none last:pr-8"> <div class="p-4 w-full rounded-lg flex items-center justify-center bg-sky-500 shadow-lg">02</div> </div> <div class="w-2/5 flex-none last:pr-8"> <div class="p-4 w-full rounded-lg flex items-center justify-center bg-sky-500 shadow-lg">03</div> </div> </div> <p>使用 flex-wrap:</p> <div class="flex flex-wrap gap-4 font-mono text-white text-sm font-bold leading-6 bg-stripes-indigo rounded-lg"> <div class="p-4 w-2/5 rounded-lg flex items-center justify-center bg-indigo-500 shadow-lg">01</div> <div class="p-4 w-2/5 rounded-lg flex items-center justify-center bg-indigo-500 shadow-lg">02</div> <div class="p-4 w-2/5 rounded-lg flex items-center justify-center bg-indigo-500 shadow-lg">03</div> </div> <p>使用 flex-wrap-reverse:</p> <div class="flex flex-wrap-reverse gap-4 font-mono text-white text-sm font-bold leading-6 bg-stripes-fuchsia rounded-lg"> <div class="p-4 w-2/5 rounded-lg flex items-center justify-center bg-fuchsia-500 shadow-lg">01</div> <div class="p-4 w-2/5 rounded-lg flex items-center justify-center bg-fuchsia-500 shadow-lg">02</div> <div class="p-4 w-2/5 rounded-lg flex items-center justify-center bg-fuchsia-500 shadow-lg">03</div> </div> </div> </body> </html>
运行结果: