倒计时 效果

实现HTML

复制代码
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>信质集团SAP/ERP切换倒计时</title>
    <style>
        body {
            font-family: 'Microsoft YaHei', sans-serif;
            background-color: rgba(111, 123, 4, 0.5);
            color: white;
            text-align: center;
            margin: 0;
            padding: 0;
            height: 100vh;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
        }
        .container {
		    background: url(1.jpg);
			background-size:cover;
            padding: 40px;
            border-radius: 15px;
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
            max-width: 100%;
			height:100%;
            width: 100%;
        }
        h1 {
            font-size: 6.5rem;
			margin-top: 200px;
            margin-bottom: 160px;
            text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
        }
        .countdown {
            display: flex;
            justify-content: center;
            flex-wrap: wrap;
            gap: 20px;
        }
        .countdown-item {
            background-color: rgba(255, 255, 255, 0.2);
            padding: 40px;
			font-size: 3.5rem;
            border-radius: 20px;
            min-width: 240px;
        }
        .countdown-number {
            font-size: 5.5rem;
            font-weight: bold;
            margin: 10px 0;
            text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
        }
        .countdown-label {
            font-size: 1.2rem;
            opacity: 0.8;
        }
        .date-info {
            margin-top: 30px;
            font-size: 1.2rem;
        }
        .motivation {
            margin-top: 30px;
            font-style: italic;
            font-size: 1.3rem;
            color: #ffcc00;
        }
        @media (max-width: 600px) {
            .countdown-item {
                min-width: 80px;
                padding: 15px;
            }
            .countdown-number {
                font-size: 2.5rem;
            }
            h1 {
                font-size: 2rem;
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>全营一杆枪,SAP项目上线冲剌!</h1>
        
        <div class="countdown">
            <div class="countdown-item">
                <div class="countdown-number" id="days">00</div>
                <div class="countdown-label">天</div>
            </div>
            <div class="countdown-item">
                <div class="countdown-number" id="hours">00</div>
                <div class="countdown-label">小时</div>
            </div>
            <div class="countdown-item">
                <div class="countdown-number" id="minutes">00</div>
                <div class="countdown-label">分钟</div>
            </div>
            <div class="countdown-item">
                <div class="countdown-number" id="seconds">00</div>
                <div class="countdown-label">秒</div>
            </div>
        </div>
        
        <div class="date-info" style="display:none;" >
            <p>今天是:<span id="current-date"></span></p>
            <p>信质集团SAP/ERP切换日期:09月30日</p>
        </div>
        
        <div class="motivation" id="motivation-text"></div>
    </div>

    <script>
        // 设置高考日期 - 2025年6月7日
        const gaokaoDate = new Date('2025-09-30T00:00:00');
        
        // 励志语句数组
        const motivations = [
            "乾坤未定,你我皆是黑马!",
            "今日拼搏的汗水,终将化为明日的辉煌!",
            "每一秒的努力,都在为未来铺路!",
            "坚持就是胜利,高考加油!",
            "你的努力,终将成就更好的自己!",
            "此刻的付出,是为了遇见更好的未来!"
        ];
        
        // 更新倒计时
        function updateCountdown() {
            const now = new Date();
            const diff = gaokaoDate - now;
            
            // 计算天、小时、分钟、秒
            const days = Math.floor(diff / (1000 * 60 * 60 * 24));
            const hours = Math.floor((diff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
            const minutes = Math.floor((diff % (1000 * 60 * 60)) / (1000 * 60));
            const seconds = Math.floor((diff % (1000 * 60)) / 1000);
            
            // 更新显示
            document.getElementById('days').textContent = days.toString().padStart(2, '0');
            document.getElementById('hours').textContent = hours.toString().padStart(2, '0');
            document.getElementById('minutes').textContent = minutes.toString().padStart(2, '0');
            document.getElementById('seconds').textContent = seconds.toString().padStart(2, '0');
            
            // 更新当前日期
            const options = { year: 'numeric', month: 'long', day: 'numeric', weekday: 'long' };
            document.getElementById('current-date').textContent = now.toLocaleDateString('zh-CN', options);
        }
        
        // 随机显示励志语句
       // function showRandomMotivation() {
       //     const randomIndex = Math.floor(Math.random() * motivations.length);
       //     document.getElementById('motivation-text').textContent = motivations[randomIndex];
       // }
        
        // 初始化
        updateCountdown();
       // showRandomMotivation();
        
        // 每秒更新一次
        setInterval(updateCountdown, 1000);
        // 每30秒更换一次励志语句
        //setInterval(showRandomMotivation, 30000);
    </script>
</body>
</html>

资源图片

相关推荐
会飞的小菠菜5 小时前
快速将多个PPT、PPTX幻灯片统一转换成浏览器能直接打开的HTML网页文件
html·powerpoint·浏览器·ppt·格式转换·网页
Filotimo_6 小时前
2.CSS3.(2).html
前端·css
yinuo7 小时前
uniapp微信小程序华为鸿蒙定时器熄屏停止
前端
gnip8 小时前
vite中自动根据约定目录生成路由配置
前端·javascript
前端橙一陈9 小时前
LocalStorage Token vs HttpOnly Cookie 认证方案
前端·spring boot
~无忧花开~9 小时前
JavaScript学习笔记(十五):ES6模板字符串使用指南
开发语言·前端·javascript·vue.js·学习·es6·js
泰迪智能科技019 小时前
图书推荐丨Web数据可视化(ECharts 5)(微课版)
前端·信息可视化·echarts
CodeCraft Studio10 小时前
借助Aspose.Email,使用 Python 读取 Outlook MSG 文件
前端·python·outlook·aspose·email·msg·python读取msg文件
家里有只小肥猫11 小时前
react 初体验2
前端·react.js·前端框架
慧慧吖@11 小时前
前端发送请求时,参数的传递格式
前端