带有相关信息的矩形容器
一个具有微交互和暗黑主题支持的响应式旋转木马滑块组件。
<section class="text-gray-600 body-font"> <div class="container px-5 py-24 mx-auto"> <div class="flex flex-wrap -m-4"> <div class="lg:w-1/3 sm:w-1/2 p-4"> <div class="flex relative"> <img alt="gallery" class="absolute inset-0 w-full h-full object-cover object-center" src="https://picsum.photos/600/360"> <div class="px-8 py-10 relative z-10 w-full border-4 border-gray-200 bg-white opacity-0 hover:opacity-100"> <h2 class="tracking-widest text-sm title-font font-medium text-indigo-500 mb-1">THE SUBTITLE</h2> <h1 class="title-font text-lg font-medium text-gray-900 mb-3">Shooting Stars</h1> <p class="leading-relaxed">Photo booth fam kinfolk cold-pressed sriracha leggings jianbing microdosing tousled waistcoat.</p> </div> </div> </div> <div class="lg:w-1/3 sm:w-1/2 p-4"> <div class="flex relative"> <img alt="gallery" class="absolute inset-0 w-full h-full object-cover object-center" src="https://picsum.photos/600/360"> <div class="px-8 py-10 relative z-10 w-full border-4 border-gray-200 bg-white opacity-0 hover:opacity-100"> <h2 class="tracking-widest text-sm title-font font-medium text-indigo-500 mb-1">THE SUBTITLE</h2> <h1 class="title-font text-lg font-medium text-gray-900 mb-3">The Catalyzer</h1> <p class="leading-relaxed">Photo booth fam kinfolk cold-pressed sriracha leggings jianbing microdosing tousled waistcoat.</p> </div> </div> </div> <div class="lg:w-1/3 sm:w-1/2 p-4"> <div class="flex relative"> <img alt="gallery" class="absolute inset-0 w-full h-full object-cover object-center" src="https://picsum.photos/600/360"> <div class="px-8 py-10 relative z-10 w-full border-4 border-gray-200 bg-white opacity-0 hover:opacity-100"> <h2 class="tracking-widest text-sm title-font font-medium text-indigo-500 mb-1">THE SUBTITLE</h2> <h1 class="title-font text-lg font-medium text-gray-900 mb-3">The 400 Blows</h1> <p class="leading-relaxed">Photo booth fam kinfolk cold-pressed sriracha leggings jianbing microdosing tousled waistcoat.</p> </div> </div> </div> <div class="lg:w-1/3 sm:w-1/2 p-4"> <div class="flex relative"> <img alt="gallery" class="absolute inset-0 w-full h-full object-cover object-center" src="https://picsum.photos/600/360"> <div class="px-8 py-10 relative z-10 w-full border-4 border-gray-200 bg-white opacity-0 hover:opacity-100"> <h2 class="tracking-widest text-sm title-font font-medium text-indigo-500 mb-1">THE SUBTITLE</h2> <h1 class="title-font text-lg font-medium text-gray-900 mb-3">Neptune</h1> <p class="leading-relaxed">Photo booth fam kinfolk cold-pressed sriracha leggings jianbing microdosing tousled waistcoat.</p> </div> </div> </div> <div class="lg:w-1/3 sm:w-1/2 p-4"> <div class="flex relative"> <img alt="gallery" class="absolute inset-0 w-full h-full object-cover object-center" src="https://picsum.photos/600/360"> <div class="px-8 py-10 relative z-10 w-full border-4 border-gray-200 bg-white opacity-0 hover:opacity-100"> <h2 class="tracking-widest text-sm title-font font-medium text-indigo-500 mb-1">THE SUBTITLE</h2> <h1 class="title-font text-lg font-medium text-gray-900 mb-3">Holden Caulfield</h1> <p class="leading-relaxed">Photo booth fam kinfolk cold-pressed sriracha leggings jianbing microdosing tousled waistcoat.</p> </div> </div> </div> <div class="lg:w-1/3 sm:w-1/2 p-4"> <div class="flex relative"> <img alt="gallery" class="absolute inset-0 w-full h-full object-cover object-center" src="https://picsum.photos/600/360"> <div class="px-8 py-10 relative z-10 w-full border-4 border-gray-200 bg-white opacity-0 hover:opacity-100"> <h2 class="tracking-widest text-sm title-font font-medium text-indigo-500 mb-1">THE SUBTITLE</h2> <h1 class="title-font text-lg font-medium text-gray-900 mb-3">Alper Kamu</h1> <p class="leading-relaxed">Photo booth fam kinfolk cold-pressed sriracha leggings jianbing microdosing tousled waistcoat.</p> </div> </div> </div> </div> </div> </section>
一个采用Tailwind CSS的野性主义旋转木马滑块,具有响应式和暗黑模式。包括导航按钮并使用占位图像。
<section class="bg-white dark:bg-black text-black dark:text-white p-8"> <div class="container mx-auto"> <div class="relative" data-carousel="static"> <!-- Carousel wrapper --> <div class="relative h-56 overflow-hidden rounded-lg md:h-96"> <!-- Item 1 --> <div class="hidden duration-700 ease-in-out" data-carousel-item> <img src="https://picsum.photos/id/237/800/400" class="absolute block w-full -translate-x-1/2 -translate-y-1/2 top-1/2 left-1/2" alt="Placeholder Image 1"> </div> <!-- Item 2 --> <div class="hidden duration-700 ease-in-out" data-carousel-item> <img src="https://picsum.photos/id/238/800/400" class="absolute block w-full -translate-x-1/2 -translate-y-1/2 top-1/2 left-1/2" alt="Placeholder Image 2"> </div> <!-- Item 3 --> <div class="hidden duration-700 ease-in-out" data-carousel-item> <img src="https://picsum.photos/id/239/800/400" class="absolute block w-full -translate-x-1/2 -translate-y-1/2 top-1/2 left-1/2" alt="Placeholder Image 3"> </div> </div> <!-- Slider indicators --> <div class="absolute z-30 flex -translate-x-1/2 bottom-5 left-1/2 space-x-3 rtl:space-x-reverse"> <button type="button" class="w-3 h-3 rounded-full bg-black dark:bg-white" aria-current="true" aria-label="Slide 1" data-carousel-slide-to="0"></button> <button type="button" class="w-3 h-3 rounded-full bg-black dark:bg-white" aria-current="false" aria-label="Slide 2" data-carousel-slide-to="1"></button> <button type="button" class="w-3 h-3 rounded-full bg-black dark:bg-white" aria-current="false" aria-label="Slide 3" data-carousel-slide-to="2"></button> </div> <!-- Slider controls --> <button type="button" class="absolute top-0 start-0 z-30 flex items-center justify-center h-full px-4 cursor-pointer group focus:outline-none" data-carousel-prev> <span class="inline-flex items-center justify-center w-10 h-10 rounded-full bg-black/30 dark:bg-white/30 group-hover:bg-black/50 dark:group-hover:bg-white/50 group-focus:ring-4 group-focus:ring-black/40 dark:group-focus:ring-white/40"> <svg class="w-4 h-4 text-white dark:text-black rtl:rotate-180" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 6 10"> <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 1 1 5l4 4"/> </svg> <span class="sr-only">Previous</span> </span> </button> <button type="button" class="absolute top-0 end-0 z-30 flex items-center justify-center h-full px-4 cursor-pointer group focus:outline-none" data-carousel-next> <span class="inline-flex items-center justify-center w-10 h-10 rounded-full bg-black/30 dark:bg-white/30 group-hover:bg-black/50 dark:group-hover:bg-white/50 group-focus:ring-4 group-focus:ring-black/40 dark:group-focus:ring-white/40"> <svg class="w-4 h-4 text-white dark:text-black rtl:rotate-180" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 6 10"> <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 9 4-4-4-4"/> </svg> <span class="sr-only">Next</span> </span> </button> </div> </div> </section>
一个具有磨玻璃设计和暗模式支持的轮播滑块组件。
<div class="relative w-full" data-carousel="static"> <!-- Carousel wrapper --> <div class="relative h-56 overflow-hidden rounded-lg md:h-96"> <!-- Item 1 --> <div class="hidden duration-700 ease-in-out" data-carousel-item> <img src="https://picsum.photos/seed/image1/1920/1080" class="absolute block w-full -translate-x-1/2 top-1/2 left-1/2" alt="..."> <div class="absolute inset-0 backdrop-filter backdrop-blur-lg bg-white bg-opacity-10 flex items-center justify-center"> <h2 class="text-white text-3xl font-bold">Slide 1 Title</h2> </div> </div> <!-- Item 2 --> <div class="hidden duration-700 ease-in-out" data-carousel-item="active"> <img src="https://picsum.photos/seed/image2/1920/1080" class="absolute block w-full -translate-x-1/2 top-1/2 left-1/2" alt="..."> <div class="absolute inset-0 backdrop-filter backdrop-blur-lg bg-white bg-opacity-10 flex items-center justify-center"> <h2 class="text-white text-3xl font-bold">Slide 2 Title</h2> </div> </div> <!-- Item 3 --> <div class="hidden duration-700 ease-in-out" data-carousel-item> <img src="https://picsum.photos/seed/image3/1920/1080" class="absolute block w-full -translate-x-1/2 top-1/2 left-1/2" alt="..."> <div class="absolute inset-0 backdrop-filter backdrop-blur-lg bg-white bg-opacity-10 flex items-center justify-center"> <h2 class="text-white text-3xl font-bold">Slide 3 Title</h2> </div> </div> <!-- Item 4 --> <div class="hidden duration-700 ease-in-out" data-carousel-item> <img src="https://picsum.photos/seed/image4/1920/1080" class="absolute block w-full -translate-x-1/2 top-1/2 left-1/2" alt="..."> <div class="absolute inset-0 backdrop-filter backdrop-blur-lg bg-white bg-opacity-10 flex items-center justify-center"> <h2 class="text-white text-3xl font-bold">Slide 4 Title</h2> </div> </div> <!-- Item 5 --> <div class="hidden duration-700 ease-in-out" data-carousel-item> <img src="https://picsum.photos/seed/image5/1920/1080" class="absolute block w-full -translate-x-1/2 top-1/2 left-1/2" alt="..."> <div class="absolute inset-0 backdrop-filter backdrop-blur-lg bg-white bg-opacity-10 flex items-center justify-center"> <h2 class="text-white text-3xl font-bold">Slide 5 Title</h2> </div> </div> </div> <!-- Slider indicators --> <div class="absolute z-30 flex -translate-x-1/2 bottom-5 left-1/2 space-x-3 rtl:space-x-reverse"> <button type="button" class="w-3 h-3 rounded-full" aria-current="true" aria-label="Slide 1" data-carousel-slide-to="0"></button> <button type="button" class="w-3 h-3 rounded-full" aria-current="false" aria-label="Slide 2" data-carousel-slide-to="1"></button> <button type="button" class="w-3 h-3 rounded-full" aria-current="false" aria-label="Slide 3" data-carousel-slide-to="2"></button> <button type="button" class="w-3 h-3 rounded-full" aria-current="false" aria-label="Slide 4" data-carousel-slide-to="3"></button> <button type="button" class="w-3 h-3 rounded-full" aria-current="false" aria-label="Slide 5" data-carousel-slide-to="4"></button> </div> <!-- Slider controls --> <button type="button" class="absolute top-0 start-0 z-30 flex items-center justify-center h-full px-4 cursor-pointer group focus:outline-none" data-carousel-prev> <span class="inline-flex items-center justify-center w-10 h-10 rounded-full bg-white/30 dark:bg-gray-800/30 group-hover:bg-white/50 dark:group-hover:bg-gray-800/60 group-focus:ring-4 group-focus:ring-white dark:group-focus:ring-gray-800/70 group-focus:outline-none"> <svg class="w-4 h-4 text-white dark:text-gray-800 rtl:rotate-180" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 6 10"> <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 1 1 5l4 4"/> </svg> <span class="sr-only">Previous</span> </span> </button> <button type="button" class="absolute top-0 end-0 z-30 flex items-center justify-center h-full px-4 cursor-pointer group focus:outline-none" data-carousel-next> <span class="inline-flex items-center justify-center w-10 h-10 rounded-full bg-white/30 dark:bg-gray-800/30 group-hover:bg-white/50 dark:group-hover:bg-gray-800/60 group-focus:ring-4 group-focus:ring-white dark:group-focus:ring-gray-800/70 group-focus:outline-none"> <svg class="w-4 h-4 text-white dark:text-gray-800 rtl:rotate-180" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 6 10"> <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M1 9l4-4-4-4"/> </svg> <span class="sr-only">Next</span> </span> </button> </div>
一个响应式轮播滑块组件,采用极简风格设计,使用Tailwind CSS,具有高对比度、不寻常的布局和深色主题支持。
<div class="relative w-full h-64 overflow-hidden bg-gray-800" data-theme="dark"> <div class="absolute top-0 left-0 w-full h-full flex items-center justify-center"> <div class="absolute w-full h-full bg-gray-800 transition duration-300 ease-in-out transform scale-110 opacity-75"></div> <div class="carousel-slide transition-all duration-500 ease-in-out transform space-x-4"> <div class="carousel-item bg-gray-900 h-64 flex justify-center items-center flex-col"> <img class="w-full h-full object-cover rounded-lg" src="https://picsum.photos/800/400?random=1" alt="Carousel Image 1"> <p class="text-white mt-2">Slide 1</p> </div> <div class="carousel-item bg-gray-900 h-64 flex justify-center items-center flex-col"> <img class="w-full h-full object-cover rounded-lg" src="https://picsum.photos/800/400?random=2" alt="Carousel Image 2"> <p class="text-white mt-2">Slide 2</p> </div> <div class="carousel-item bg-gray-900 h-64 flex justify-center items-center flex-col"> <img class="w-full h-full object-cover rounded-lg" src="https://picsum.photos/800/400?random=3" alt="Carousel Image 3"> <p class="text-white mt-2">Slide 3</p> </div> <div class="carousel-item bg-gray-900 h-64 flex justify-center items-center flex-col"> <img class="w-full h-full object-cover rounded-lg" src="https://picsum.photos/800/400?random=4" alt="Carousel Image 4"> <p class="text-white mt-2">Slide 4</p> </div> </div> </div> <button class="absolute left-4 top-1/2 transform -translate-y-1/2 p-2 bg-gray-700 rounded-full text-white hover:bg-gray-600 focus:outline-none"> ❮ </button> <button class="absolute right-4 top-1/2 transform -translate-y-1/2 p-2 bg-gray-700 rounded-full text-white hover:bg-gray-600 focus:outline-none"> ❯ </button> </div> <style> [data-theme="dark"] { background-color: #1a202c; } </style>
一个极简的轮播滑块组件,具备响应设计和深色主题支持。
<div class="relative bg-white dark:bg-gray-800 rounded-lg overflow-hidden shadow-lg"> <div class="overflow-hidden"> <div class="flex transition-transform duration-300 ease-in-out" style="transform: translateX(0%);"> <div class="min-w-full flex-shrink-0"> <img src="https://picsum.photos/800/400?random=1" alt="Carousel Image 1" class="w-full h-auto" /> </div> <div class="min-w-full flex-shrink-0"> <img src="https://picsum.photos/800/400?random=2" alt="Carousel Image 2" class="w-full h-auto" /> </div> <div class="min-w-full flex-shrink-0"> <img src="https://picsum.photos/800/400?random=3" alt="Carousel Image 3" class="w-full h-auto" /> </div> </div> </div> <div class="absolute inset-0 flex items-center justify-between p-4"> <button class="bg-white dark:bg-gray-700 text-black dark:text-white p-2 rounded-full shadow-lg hover:bg-gray-200 dark:hover:bg-gray-600"> ❮ </button> <button class="bg-white dark:bg-gray-700 text-black dark:text-white p-2 rounded-full shadow-lg hover:bg-gray-200 dark:hover:bg-gray-600"> ❯ </button> </div> </div> <style> /* Dark mode support */ @media (prefers-color-scheme: dark) { .bg-gray-800 { background-color: #1F2937; } .hover\:bg-gray-600:hover { background-color: #4B5563; } } </style>