Toggle navigation
☰
Home
HTML
CSS
Scripting
Database
<!DOCTYPE html> <title>My Example</title> <!-- ====================================================================== CSS - Place this in your <head> or in an external stylesheet. ====================================================================== --> <style> :root { --lto-padding: 3rem 1.5rem; --lto-bg-color: #f8f9fa; --lto-text-color: #343a40; --lto-headline-color: #d9534f; --lto-timer-bg: #ffffff; --lto-timer-text-color: #d9534f; --lto-timer-label-color: #6c757d; --lto-cta-bg: #5cb85c; --lto-cta-hover-bg: #4cae4c; --lto-cta-text: #ffffff; } .lto-hero { box-sizing: border-box; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; background-color: var(--lto-bg-color); color: var(--lto-text-color); padding: var(--lto-padding); width: 100%; display: flex; justify-content: center; align-items: center; text-align: center; } .lto-hero * { box-sizing: border-box; } .lto-hero-content { max-width: 700px; } .lto-hero-headline { margin: 0 0 1rem 0; font-size: clamp(2rem, 5vw, 3rem); font-weight: 700; color: var(--lto-headline-color); } .lto-hero-subheading { margin: 0 0 2rem 0; font-size: clamp(1rem, 2.5vw, 1.2rem); max-width: 600px; margin-left: auto; margin-right: auto; line-height: 1.6; } .lto-hero-timer { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: center; margin-bottom: 2.5rem; } .lto-hero-timer-block { background-color: var(--lto-timer-bg); padding: 1rem; border-radius: 8px; box-shadow: 0 4px 10px rgba(0,0,0,0.05); min-width: 80px; display: flex; flex-direction: column; align-items: center; } .lto-hero-timer-time { color: var(--lto-timer-text-color); font-size: clamp(2rem, 6vw, 2.5rem); font-weight: 700; line-height: 1; } .lto-hero-timer-label { color: var(--lto-timer-label-color); font-size: 0.75rem; text-transform: uppercase; font-weight: 600; letter-spacing: 0.5px; margin-top: 0.25rem; } .lto-hero #lto-expired-message { font-size: 1.5rem; font-weight: bold; color: var(--lto-headline-color); } .lto-hero-cta { background-color: var(--lto-cta-bg); color: var(--lto-cta-text); border: none; padding: 0.8rem 2rem; font-size: 1rem; font-weight: 600; border-radius: 5px; cursor: pointer; text-decoration: none; transition: background-color 0.3s ease; display: inline-block; } .lto-hero-cta:hover { background-color: var(--lto-cta-hover-bg); } </style> <!-- ====================================================================== HTML - Place this in your <body> where you want the component to appear. ====================================================================== --> <section class="lto-hero"> <div class="lto-hero-content"> <h1 class="lto-hero-headline">Hurry! This Exclusive Offer Ends Soon</h1> <p class="lto-hero-subheading">Don't miss out on our limited-edition collection. Once it's gone, it's gone forever!</p> <div id="lto-timer-container" class="lto-hero-timer"> <div class="lto-hero-timer-block"> <span id="lto-days" class="lto-hero-timer-time">00</span> <span class="lto-hero-timer-label">Days</span> </div> <div class="lto-hero-timer-block"> <span id="lto-hours" class="lto-hero-timer-time">00</span> <span class="lto-hero-timer-label">Hours</span> </div> <div class="lto-hero-timer-block"> <span id="lto-minutes" class="lto-hero-timer-time">00</span> <span class="lto-hero-timer-label">Minutes</span> </div> <div class="lto-hero-timer-block"> <span id="lto-seconds" class="lto-hero-timer-time">00</span> <span class="lto-hero-timer-label">Seconds</span> </div> </div> <a href="#" role="button" class="lto-hero-cta">Claim Your Deal</a> </div> <script> (function() { // --- IMPORTANT: Set your offer's expiration date here --- // The format is "Month Day, Year HH:MM:SS" e.g., "Jan 5, 2029 15:37:25" const countdownDate = new Date("Mar 14, 2028 23:59:59").getTime(); const daysEl = document.getElementById("lto-days"); const hoursEl = document.getElementById("lto-hours"); const minutesEl = document.getElementById("lto-minutes"); const secondsEl = document.getElementById("lto-seconds"); const timerContainer = document.getElementById("lto-timer-container"); if (!daysEl || !hoursEl || !minutesEl || !secondsEl || !timerContainer) { console.error("Countdown timer elements not found."); return; } const countdownInterval = setInterval(function() { const now = new Date().getTime(); const distance = countdownDate - now; if (distance < 0) { clearInterval(countdownInterval); timerContainer.innerHTML = '<p id="lto-expired-message">This Offer Has Expired</p>'; return; } const days = Math.floor(distance / (1000 * 60 * 60 * 24)); const hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); const minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); const seconds = Math.floor((distance % (1000 * 60)) / 1000); daysEl.textContent = days.toString().padStart(2, '0'); hoursEl.textContent = hours.toString().padStart(2, '0'); minutesEl.textContent = minutes.toString().padStart(2, '0'); secondsEl.textContent = seconds.toString().padStart(2, '0'); }, 1000); })(); </script> </section>