热搜: 活动 交友 discuz
查看: 3030|回复: 5

[htm] 2025春节大年初一倒计时代码

[复制链接]
发表于 2025-1-13 22:23:26 | 显示全部楼层 |阅读模式





  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4.     <meta charset="UTF-8">
  5.     <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6.     <title>2025春节大年初一倒计时</title>
  7.     <style>
  8.         body {
  9.             font-family: 'Arial', sans-serif;
  10.             background: linear-gradient(to right, #ff7e5f, #feb47b);
  11.             color: white;
  12.             text-align: center;
  13.             padding: 50px;
  14.         }
  15.         h1 {
  16.             font-size: 3em;
  17.             margin-bottom: 20px;
  18.         }
  19.         #countdown {
  20.             font-size: 2em;
  21.             margin-bottom: 20px;
  22.         }
  23.         .container {
  24.             display: inline-block;
  25.             padding: 20px;
  26.             border-radius: 10px;
  27.             background: rgba(0, 0, 0, 0.5);
  28.         }
  29.         .time-box {
  30.             display: inline-block;
  31.             margin: 0 10px;
  32.             padding: 10px;
  33.             background: rgba(255, 255, 255, 0.2);
  34.             border-radius: 5px;
  35.         }
  36.         .time-box span {
  37.             display: block;
  38.             font-size: 1.5em;
  39.         }
  40.         .time-box b {
  41.             font-size: 2em;
  42.         }
  43.     </style>
  44. </head>
  45. <body>
  46.     <div class="container">
  47.         <h1>2025春节大年初一倒计时</h1>
  48.         <div id="countdown">
  49.             <div class="time-box"><span>天</span><b id="days"></b></div>
  50.             <div class="time-box"><span>时</span><b id="hours"></b></div>
  51.             <div class="time-box"><span>分</span><b id="minutes"></b></div>
  52.             <div class="time-box"><span>秒</span><b id="seconds"></b></div>
  53.         </div>
  54.     </div>

  55.     <script>
  56.         function updateCountdown() {
  57.             const targetDate = new Date('January 29, 2025 00:00:00').getTime(); // 修改为2025年新年
  58.             const now = new Date().getTime();
  59.             const timeDifference = targetDate - now;

  60.             const days = Math.floor(timeDifference / (1000 * 60 * 60 * 24));
  61.             const hours = Math.floor((timeDifference % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
  62.             const minutes = Math.floor((timeDifference % (1000 * 60 * 60)) / (1000 * 60));
  63.             const seconds = Math.floor((timeDifference % (1000 * 60)) / 1000);

  64.             document.getElementById('days').innerText = days;
  65.             document.getElementById('hours').innerText = hours;
  66.             document.getElementById('minutes').innerText = minutes;
  67.             document.getElementById('seconds').innerText = seconds;
  68.         }

  69.         setInterval(updateCountdown, 1000);
  70.         updateCountdown();
  71.     </script>
  72. </body>
  73. </html>
复制代码




世上无难事,实在不行就摇铃

200

主题

1135

回帖

1万

积分

社区贵宾

积分
16087

最佳新人活跃会员热心会员推广达人宣传达人灌水之王突出贡献

发表于 2025-1-13 23:26:10 | 显示全部楼层
很应景哇~时光匆匆,面向未来,活好当下!
该会员没有填写今日想说内容.
发表于 2025-1-14 07:01:22 | 显示全部楼层
欣赏老大春节倒计时代码!

0

主题

0

回帖

11

积分

黑铁会员

积分
11
发表于 2025-1-14 13:30:01 | 显示全部楼层
我表示压力很大

0

主题

0

回帖

7

积分

黑铁会员

积分
7
发表于 2025-1-14 20:41:36 | 显示全部楼层
非常不错,感谢分享!

0

主题

0

回帖

11

积分

黑铁会员

积分
11
发表于 2025-1-22 19:22:33 | 显示全部楼层
必须支持。。。。。。。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|小黑屋|纳兰音画网 ( 蜀ICP备2021011087号-1 )

GMT+8, 2026-11-9 00:11 , Processed in 0.061261 second(s), 23 queries .

Powered by Discuz! X5.0

© 2001-2020 Comsenz Inc.

快速回复 返回顶部 返回列表