Real Estate 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>Real Estate Slider</title> </head> <body> <div class="slider-container"> <div class="slider-track"> <div class="slide"> <img src="https://images.unsplash.com/photo-1600585154340-be6161a56a0c" alt="Luxury Villa"> <div class="slide-content"> <h2>Luxury Villas</h2> <p>Discover modern villas with private pools, lush gardens, and premium interiors designed for a luxurious lifestyle.</p> <a href="#" class="btn">View Details</a> </div> </div> <div class="slide"> <img src="https://images.unsplash.com/photo-1564013799919-ab600027ffc6" alt="Modern Apartment"> <div class="slide-content"> <h2>Modern Apartments</h2> <p>Live in the heart of the city with our stylish apartments featuring skyline views and world-class amenities.</p> <a href="#" class="btn">View Details</a> </div> </div> <div class="slide"> <img src="https://images.unsplash.com/photo-1580587771525-78b9dba3b914" alt="Beach House"> <div class="slide-content"> <h2>Beach Houses</h2> <p>Wake up to the sound of waves with stunning beach houses offering sea-facing balconies and modern comfort.</p> <a href="#" class="btn">View Details</a> </div> </div> </div> <!-- Navigation Buttons --> <button class="nav-btn prev">❮</button> <button class="nav-btn next">❯</button> </div> </body> </html>
CSS
body { font-family: 'Poppins', sans-serif; margin: 0; padding: 0; background: #f5f7fa; } .slider-container { width: 100%; max-width: 1200px; margin: 40px auto; position: relative; overflow: hidden; border-radius: 15px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); } .slider-track { display: flex; transition: transform 0.8s ease-in-out; } .slide { min-width: 100%; position: relative; color: white; } .slide img { width: 100%; height: 500px; object-fit: cover; filter: brightness(65%); } .slide-content { position: absolute; top: 50%; left: 10%; transform: translateY(-50%); max-width: 500px; } .slide-content h2 { font-size: 40px; margin-bottom: 15px; font-weight: 700; } .slide-content p { font-size: 18px; margin-bottom: 20px; line-height: 1.5; } .btn { background: #e63946; color: #fff; padding: 12px 28px; text-decoration: none; border-radius: 8px; font-weight: 600; transition: 0.3s; } .btn:hover { background: #d62828; } /* Navigation */ .nav-btn { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(0,0,0,0.6); color: white; border: none; font-size: 30px; cursor: pointer; padding: 10px 15px; border-radius: 50%; z-index: 10; transition: 0.3s; } .nav-btn:hover { background: rgba(0,0,0,0.8); } .prev { left: 15px; } .next { right: 15px; } @media (max-width: 768px) { .slide-content h2 { font-size: 28px; } .slide-content p { font-size: 16px; } .btn { padding: 10px 20px; } }
JavaScript
const track = document.querySelector('.slider-track'); const slides = document.querySelectorAll('.slide'); const prevBtn = document.querySelector('.prev'); const nextBtn = document.querySelector('.next'); let index = 0; function updateSlide() { track.style.transform = `translateX(-${index * 100}%)`; } nextBtn.addEventListener('click', () => { index = (index + 1) % slides.length; updateSlide(); }); prevBtn.addEventListener('click', () => { index = (index - 1 + slides.length) % slides.length; updateSlide(); }); // Auto Slide setInterval(() => { index = (index + 1) % slides.length; updateSlide(); }, 5000);
Output Preview
Desktop
Mobile
Fullscreen