<!-- 制作:AI 资源宝:www.httple.net 时间:2025-6-21 --> <!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>网站维护倒计时</title> <style> body { font-family: Arial, sans-serif; background-color: #3498db; /* 设置背景颜色为蓝色 */ color: white; display: flex; height: 100vh; justify-content: center; align-items: center; } .countdown-container { text-align: center; background: rgba(0, 0, 0, 0.7); /* 半透明黑色背景 */ padding: 20px 40px; border-radius: 10px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); } .countdown h1 { margin: 0; font-size: 3em; } .countdown p { margin: 10px 0; font-size: 1.2em; } .maintenance-tip { margin-top: 20px; font-size: 1.1em; } </style> </head> <body> <div class="countdown-container"> <div class="countdown"> <h1>00:00:00</h1> <p>网站将在以上时间后恢复访问</p> </div> <div class="maintenance-tip"> <p>我们正在进行网站维护,请稍后再访问!</p> <p>感谢您的耐心等待。</p> </div> </div> <script> // 设置目标日期(网站上线的时间) var countDownDate = new Date("June 22, 2025 00:00:00").getTime(); var x = setInterval(function() { // 获取当前日期和时间 var now = new Date().getTime(); // 计算距离目标日期的时间差 var distance = countDownDate - now; if (distance < 0) { clearInterval(x); document.querySelector('.countdown h1').textContent = "时间已到!"; return; } // 时间计算:年、月、日、小时、分钟和秒 var years = Math.floor(distance / (1000 * 60 * 60 * 24 * 365)); var months = Math.floor((distance % (1000 * 60 * 60 * 24 * 365)) / (1000 * 60 * 60 * 24 * 30)); var days = Math.floor((distance % (1000 * 60 * 60 * 24 * 30)) / (1000 * 60 * 60 * 24)); var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); var seconds = Math.floor((distance % (1000 * 60)) / 1000); // 输出结果到HTML元素中 document.querySelector('.countdown h1').textContent = days + "天 " + hours + "时 " + minutes + "分 " + seconds + "秒 "; }, 1000); </script> </body> </html>
最新优化
美化版
<!-- 制作:AI 资源宝:www.httple.net 时间:2025-6-21 --> <!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>网站维护倒计时</title> <style> @keyframes gradient { 0% { background-color: #ff00cc; } 25% { background-color: #3333ff; } 50% { background-color: #00ccff; } 75% { background-color: #00ff99; } 100% { background-color: #ff00cc; } } body { font-family: 'Orbitron', sans-serif; /* 使用具有科幻感的字体 */ background: linear-gradient(135deg, #ff00cc, #3333ff, #00ccff, #00ff99); /* 渐变背景 */ background-size: 400% 400%; animation: gradient 10s ease infinite; /* 动态渐变动画 */ color: white; /* 白色文字 */ display: flex; height: 100vh; justify-content: center; align-items: center; margin: 0; overflow: hidden; } .countdown-container { text-align: center; background: rgba(0, 0, 0, 0.7); /* 深色半透明背景 */ padding: 40px 60px; border-radius: 20px; box-shadow: 0 5px 30px rgba(0, 0, 0, 0.4); } .countdown h1 { margin: 0; font-size: 5em; /* 更大的时间数显示 */ text-shadow: 0 0 10px #00ffcc, 0 0 20px #00ccff; /* 添加发光效果 */ } .countdown p { margin: 10px 0; font-size: 1.8em; /* 更大字体 */ opacity: 0.9; text-shadow: 0 0 5px #00ffcc, 0 0 10px #00ccff; /* 科幻风格的文字阴影 */ } .maintenance-tip { margin-top: 25px; font-size: 1.5em; /* 更大字体 */ text-shadow: 0 0 5px #ffffff, 0 0 10px #00ffcc; /* 亮色文字阴影效果 */ } </style> <link href="https://fonts.googleapis.com/css2?family=Orbitron&display=swap" rel="stylesheet"> <!-- 引入Orbitron字体 --> </head> <body> <div class="countdown-container"> <div class="countdown"> <h1>00:00:00</h1> <p>网站将在以上时间后恢复访问</p> </div> <div class="maintenance-tip"> <p>我们正在进行网站维护,请稍后再访问!</p> <p>感谢您的耐心等待。</p> </div> </div> <script> var countDownDate = new Date("June 22, 2025 00:00:00").getTime(); var x = setInterval(function() { var now = new Date().getTime(); var distance = countDownDate - now; if (distance < 0) { clearInterval(x); document.querySelector('.countdown h1').textContent = "时间已到!"; return; } var days = Math.floor(distance / (1000 * 60 * 60 * 24)); var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); var seconds = Math.floor((distance % (1000 * 60)) / 1000); document.querySelector('.countdown h1').textContent = days + "天 " + hours + "时 " + minutes + "分 " + seconds + "秒 "; }, 1000); </script> </body> </html>