Fashion Collection Slider
Preview
Edit
Download
Run
Download Options
HTML File
Download as .html file
CSS File
Download as .css file
JavaScript File
Download as .js file
Combined HTML
All code in one HTML file
Project ZIP
All files in a ZIP archive
Cancel
HTML
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Fashion Collection Slider</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> <link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600;700;800&family=Playfair+Display:wght@700&display=swap" rel="stylesheet"> </head> <body> <div class="container"> <div class="header"> <h1>Spring Fashion Collection</h1> <p>Discover the latest trends in fashion with our exclusive collection</p> </div> <div class="slider-container"> <div class="slider"> <!-- Slide 1 --> <div class="slide active"> <div class="model-section"> <img src="https://images.unsplash.com/photo-1479936343636-73cdc5aae0c3?ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxzZWFyY2h8MzB8fHdvbWFufGVufDB8fDB8fHww&auto=format&fit=crop&q=60&w=500" alt="Fashion Model" class="model-image"> <div class="product-badge">BEST SELLER</div> </div> <div class="product-info"> <div class="category">Women's Fashion</div> <h2 class="product-title">Elegant Evening Dress</h2> <p class="product-description">Make a statement at any event with this stunning evening dress. Crafted from premium silk with intricate detailing and a flattering silhouette that accentuates your figure.</p> <div class="price-section"> <div class="price">$89.99</div> <div class="original-price">$129.99</div> <div class="discount">30% OFF</div> </div> <div class="size-selector"> <div class="size-title">Select Size:</div> <div class="sizes"> <div class="size">XS</div> <div class="size selected">S</div> <div class="size">M</div> <div class="size">L</div> <div class="size">XL</div> </div> </div> <div class="color-selector"> <div class="color-title">Available Colors:</div> <div class="colors"> <div class="color selected" style="background-color: #1a1a2e;"></div> <div class="color" style="background-color: #da1b60;"></div> <div class="color" style="background-color: #4cc9f0;"></div> <div class="color" style="background-color: #ff8a00;"></div> </div> </div> <div class="actions"> <button class="btn btn-primary"> <span>Add to Cart</span> <i class="fas fa-shopping-cart"></i> </button> <button class="btn btn-secondary"> <span>Wishlist</span> <i class="fas fa-heart"></i> </button> </div> </div> <div class="slide-counter">01 / 03</div> </div> <!-- Slide 2 --> <div class="slide"> <div class="model-section"> <img src="https://images.unsplash.com/photo-1706765779494-2705542ebe74?ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxzZWFyY2h8MTJ8fGphY2tldHxlbnwwfHwwfHx8MA%3D%3D&auto=format&fit=crop&q=60&w=500" alt="Men's Fashion" class="model-image"> <div class="product-badge">NEW ARRIVAL</div> </div> <div class="product-info"> <div class="category">Men's Collection</div> <h2 class="product-title">Premium Suit Jacket</h2> <p class="product-description">Elevate your formal wardrobe with this impeccably tailored suit jacket. Made from high-quality wool blend with modern cut and comfortable fit for all-day wear.</p> <div class="price-section"> <div class="price">$149.99</div> <div class="original-price">$199.99</div> <div class="discount">25% OFF</div> </div> <div class="size-selector"> <div class="size-title">Select Size:</div> <div class="sizes"> <div class="size">S</div> <div class="size selected">M</div> <div class="size">L</div> <div class="size">XL</div> <div class="size">XXL</div> </div> </div> <div class="color-selector"> <div class="color-title">Available Colors:</div> <div class="colors"> <div class="color selected" style="background-color: #2c2c54;"></div> <div class="color" style="background-color: #1e272e;"></div> <div class="color" style="background-color: #485460;"></div> <div class="color" style="background-color: #808e9b;"></div> </div> </div> <div class="actions"> <button class="btn btn-primary"> <span>Add to Cart</span> <i class="fas fa-shopping-cart"></i> </button> <button class="btn btn-secondary"> <span>Wishlist</span> <i class="fas fa-heart"></i> </div> </div> </div> <div class="slide-counter">02 / 03</div> </div> <!-- Slide 3 --> <div class="slide"> <div class="model-section"> <img src="https://images.unsplash.com/photo-1485231183945-fffde7cb34eb?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8MTB8fGNhc3VhbCUyMGZhc2hpb258ZW58MHx8MHx8fDA%3D&auto=format&fit=crop&w=500&q=60" alt="Casual Fashion" class="model-image"> <div class="product-badge">LIMITED EDITION</div> </div> <div class="product-info"> <div class="category">Casual Wear</div> <h2 class="product-title">Designer Hoodie & Joggers</h2> <p class="product-description">Stay comfortable and stylish with this matching hoodie and joggers set. Made from premium cotton blend with unique design elements and perfect for everyday wear.</p> <div class="price-section"> <div class="price">$79.99</div> <div class="original-price">$99.99</div> <div class="discount">20% OFF</div> </div> <div class="size-selector"> <div class="size-title">Select Size:</div> <div class="sizes"> <div class="size">XS</div> <div class="size">S</div> <div class="size selected">M</div> <div class="size">L</div> <div class="size">XL</div> </div> </div> <div class="color-selector"> <div class="color-title">Available Colors:</div> <div class="colors"> <div class="color" style="background-color: #1a1a2e;"></div> <div class="color selected" style="background-color: #ff8a00;"></div> <div class="color" style="background-color: #4cc9f0;"></div> <div class="color" style="background-color: #da1b60;"></div> </div> </div> <div class="actions"> <button class="btn btn-primary"> <span>Add to Cart</span> <i class="fas fa-shopping-cart"></i> </button> <button class="btn btn-secondary"> <span>Wishlist</span> <i class="fas fa-heart"></i> </button> </div> </div> <div class="slide-counter">03 / 03</div> </div> </div> <!-- Navigation Buttons --> <div class="nav-btn prev"> <i class="fas fa-chevron-left"></i> </div> <div class="nav-btn next"> <i class="fas fa-chevron-right"></i> </div> <!-- Dots Indicator --> <div class="slider-controls"> <div class="slider-dot active"></div> <div class="slider-dot"></div> <div class="slider-dot"></div> </div> </div> </div> </body> </html>
CSS
* { margin: 0; padding: 0; box-sizing: border-box; } body { background: linear-gradient(135deg, #0c0c0c 0%, #1a1a2e 50%, #16213e 100%); color: #fff; min-height: 100vh; display: flex; justify-content: center; align-items: center; padding: 20px; font-family: 'Montserrat', sans-serif; overflow-x: hidden; } .container { max-width: 1400px; width: 100%; position: relative; } .header { text-align: center; margin-bottom: 40px; } .header h1 { font-family: 'Playfair Display', serif; font-size: 3.5rem; background: linear-gradient(to right, #ff8a00, #da1b60, #4cc9f0); -webkit-background-clip: text; -webkit-text-fill-color: transparent; margin-bottom: 10px; letter-spacing: 1px; } .header p { color: #d0d0d0; font-size: 1.2rem; max-width: 600px; margin: 0 auto; } .slider-container { position: relative; overflow: hidden; border-radius: 20px; box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6); background: rgba(20, 20, 30, 0.9); backdrop-filter: blur(10px); height: 700px; } .slider { display: flex; transition: transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94); height: 100%; } .slide { min-width: 100%; position: relative; display: flex; padding: 0; overflow: hidden; } .model-section { flex: 1.2; position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; } .model-image { width: 100%; height: 100%; object-fit: cover; object-position: center 30%; filter: brightness(0.9); transition: transform 1s ease; } .slide.active .model-image { transform: scale(1.05); } .product-info { flex: 0.8; padding: 50px 40px; display: flex; flex-direction: column; justify-content: center; background: rgba(15, 15, 25, 0.7); position: relative; z-index: 2; } .product-info::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: linear-gradient(45deg, rgba(18,18,28,0.8) 0%, rgba(28,28,48,0.6) 100%); z-index: -1; } .category { font-size: 1rem; color: #ff8a00; margin-bottom: 10px; font-weight: 600; letter-spacing: 2px; text-transform: uppercase; } .product-title { font-size: 2.8rem; margin-bottom: 20px; font-family: 'Playfair Display', serif; line-height: 1.1; background: linear-gradient(to right, #ff8a00, #da1b60); -webkit-background-clip: text; -webkit-text-fill-color: transparent; } .product-description { font-size: 1.1rem; line-height: 1.7; margin-bottom: 30px; color: #d0d0d0; max-width: 500px; } .price-section { display: flex; align-items: center; margin-bottom: 30px; } .price { font-size: 2.2rem; font-weight: 800; color: #4cc9f0; margin-right: 20px; } .original-price { font-size: 1.5rem; text-decoration: line-through; color: #a0a0a0; margin-right: 20px; } .discount { background: linear-gradient(45deg, #ff8a00, #da1b60); padding: 5px 15px; border-radius: 20px; font-size: 1rem; font-weight: 700; } .size-selector { margin-bottom: 30px; } .size-title { font-size: 1.1rem; margin-bottom: 15px; color: #e0e0e0; } .sizes { display: flex; gap: 12px; } .size { width: 45px; height: 45px; display: flex; align-items: center; justify-content: center; border: 2px solid rgba(255, 255, 255, 0.2); border-radius: 10px; cursor: pointer; transition: all 0.3s ease; font-weight: 600; } .size:hover { border-color: #ff8a00; transform: translateY(-3px); } .size.selected { background: linear-gradient(45deg, #ff8a00, #da1b60); border-color: transparent; } .color-selector { margin-bottom: 35px; } .color-title { font-size: 1.1rem; margin-bottom: 15px; color: #e0e0e0; } .colors { display: flex; gap: 15px; } .color { width: 35px; height: 35px; border-radius: 50%; cursor: pointer; transition: all 0.3s ease; border: 3px solid transparent; } .color:hover { transform: scale(1.2); } .color.selected { border-color: white; transform: scale(1.2); } .actions { display: flex; gap: 20px; } .btn { display: inline-flex; align-items: center; gap: 12px; padding: 18px 40px; border-radius: 50px; font-size: 1.2rem; font-weight: 700; cursor: pointer; transition: all 0.4s ease; position: relative; overflow: hidden; border: none; } .btn-primary { background: linear-gradient(45deg, #ff8a00, #da1b60); color: white; box-shadow: 0 8px 20px rgba(218, 27, 96, 0.4); flex: 2; } .btn-secondary { background: rgba(255, 255, 255, 0.1); color: white; backdrop-filter: blur(5px); border: 1px solid rgba(255, 255, 255, 0.2); flex: 1; } .btn::before { content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent); transition: 0.5s; } .btn:hover { transform: translateY(-5px); } .btn:hover::before { left: 100%; } .btn-primary:hover { box-shadow: 0 12px 25px rgba(218, 27, 96, 0.6); } .btn-secondary:hover { background: rgba(255, 255, 255, 0.15); } .btn i { font-size: 1.3rem; transition: transform 0.3s ease; } .btn:hover i { transform: translateX(5px); } .slider-controls { position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%); display: flex; gap: 15px; z-index: 10; } .slider-dot { width: 14px; height: 14px; border-radius: 50%; background: rgba(255, 255, 255, 0.3); cursor: pointer; transition: all 0.4s ease; position: relative; overflow: hidden; } .slider-dot::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: linear-gradient(45deg, #ff8a00, #da1b60); border-radius: 50%; transform: scale(0); transition: transform 0.3s ease; } .slider-dot.active::before { transform: scale(1); } .slider-dot.active { transform: scale(1.3); box-shadow: 0 0 15px rgba(255, 138, 0, 0.7); } .nav-btn { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255, 255, 255, 0.15); width: 60px; height: 60px; border-radius: 50%; display: flex; justify-content: center; align-items: center; cursor: pointer; z-index: 10; transition: all 0.4s ease; backdrop-filter: blur(10px); border: 1px solid rgba(255, 255, 255, 0.1); } .nav-btn:hover { background: rgba(255, 255, 255, 0.25); transform: translateY(-50%) scale(1.1); box-shadow: 0 0 20px rgba(255, 138, 0, 0.5); } .prev { left: 30px; } .next { right: 30px; } .nav-btn i { font-size: 1.8rem; color: white; text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3); } .slide-counter { position: absolute; top: 30px; right: 30px; font-size: 1.2rem; font-weight: 600; color: rgba(255, 255, 255, 0.7); z-index: 10; background: rgba(0, 0, 0, 0.3); padding: 8px 20px; border-radius: 20px; backdrop-filter: blur(5px); } .product-badge { position: absolute; top: 30px; left: 30px; background: linear-gradient(45deg, #ff8a00, #da1b60); padding: 8px 20px; border-radius: 20px; font-size: 0.9rem; font-weight: 700; z-index: 10; box-shadow: 0 5px 15px rgba(218, 27, 96, 0.4); } /* Responsive Design */ @media (max-width: 1200px) { .slider-container { height: 650px; } .product-title { font-size: 2.4rem; } .price { font-size: 2rem; } } @media (max-width: 992px) { .slider-container { height: 600px; } .product-title { font-size: 2rem; } .product-description { font-size: 1rem; } .price { font-size: 1.8rem; } .btn { padding: 15px 30px; font-size: 1.1rem; } } @media (max-width: 768px) { .header h1 { font-size: 2.8rem; } .slide { flex-direction: column; } .slider-container { height: auto; min-height: 800px; } .model-section { height: 400px; flex: none; } .product-info { padding: 30px 25px; } .sizes, .colors { justify-content: center; } .actions { justify-content: center; } .slider-controls { bottom: 20px; } .slide-counter, .product-badge { top: 20px; } .product-badge { left: 20px; } .nav-btn { width: 50px; height: 50px; } .nav-btn i { font-size: 1.5rem; } } @media (max-width: 576px) { .header h1 { font-size: 2.2rem; } .header p { font-size: 1rem; } .product-title { font-size: 1.8rem; } .product-description { font-size: 0.95rem; } .price { font-size: 1.6rem; } .btn { padding: 12px 25px; font-size: 1rem; } .size { width: 40px; height: 40px; } .actions { flex-direction: column; } }
JavaScript
document.addEventListener('DOMContentLoaded', function() { const slider = document.querySelector('.slider'); const slides = document.querySelectorAll('.slide'); const dots = document.querySelectorAll('.slider-dot'); const prevBtn = document.querySelector('.prev'); const nextBtn = document.querySelector('.next'); const slideCounters = document.querySelectorAll('.slide-counter'); const sizes = document.querySelectorAll('.size'); const colors = document.querySelectorAll('.color'); let currentSlide = 0; const slideCount = slides.length; // Function to update slide counter function updateSlideCounter() { slideCounters.forEach(counter => { counter.textContent = `${(currentSlide + 1).toString().padStart(2, '0')} / ${slideCount.toString().padStart(2, '0')}`; }); } // Function to go to a specific slide function goToSlide(n) { currentSlide = (n + slideCount) % slideCount; slider.style.transform = `translateX(-${currentSlide * 100}%)`; // Update active classes slides.forEach(slide => slide.classList.remove('active')); slides[currentSlide].classList.add('active'); dots.forEach(dot => dot.classList.remove('active')); dots[currentSlide].classList.add('active'); updateSlideCounter(); } // Next slide function function nextSlide() { goToSlide(currentSlide + 1); } // Previous slide function function prevSlide() { goToSlide(currentSlide - 1); } // Event listeners for navigation buttons nextBtn.addEventListener('click', nextSlide); prevBtn.addEventListener('click', prevSlide); // Event listeners for dots dots.forEach((dot, index) => { dot.addEventListener('click', () => { goToSlide(index); }); }); // Event listeners for size selection sizes.forEach(size => { size.addEventListener('click', function() { sizes.forEach(s => s.classList.remove('selected')); this.classList.add('selected'); }); }); // Event listeners for color selection colors.forEach(color => { color.addEventListener('click', function() { colors.forEach(c => c.classList.remove('selected')); this.classList.add('selected'); }); }); // Auto slide every 5 seconds let slideInterval = setInterval(nextSlide, 5000); // Pause auto-slide on hover slider.addEventListener('mouseenter', () => { clearInterval(slideInterval); }); // Resume auto-slide when not hovering slider.addEventListener('mouseleave', () => { slideInterval = setInterval(nextSlide, 5000); }); // Keyboard navigation document.addEventListener('keydown', (e) => { if (e.key === 'ArrowLeft') { prevSlide(); } else if (e.key === 'ArrowRight') { nextSlide(); } }); // Initialize slide counter updateSlideCounter(); });
Output Preview
Desktop
Mobile
Fullscreen