数字时钟edit icon

创建者:
用户VIUZ4kJ2
Fork(复制)
下载
嵌入
BUG反馈
index.html
style.css
index.js
index.html
            
            <!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>炫酷科技感时钟</title>
    <style>
        body {
            background-color: black;
            color: cyan;
            font-family: 'Arial', sans-serif;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            margin: 0;
            overflow: hidden;
        }

        .clock {
            font-size: 80px;
            font-weight: bold;
            text-shadow: 0 0 10px cyan, 0 0 20px cyan, 0 0 40px cyan;
            display: flex;
            letter-spacing: 5px;
            animation: glow 1.5s infinite alternate;
        }

        @keyframes glow {
            0% { text-shadow: 0 0 10px cyan, 0 0 20px cyan, 0 0 40px cyan; }
            100% { text-shadow: 0 0 20px cyan, 0 0 40px cyan, 0 0 60px cyan; }
        }

        /* 背景动态光环 */
        .background {
            position: absolute;
            width: 100%;
            height: 100%;
            background: radial-gradient(circle, rgba(0, 255, 255, 0.1) 10%, black 70%);
            animation: pulse 5s infinite alternate;
        }

        @keyframes pulse {
            0% { background: radial-gradient(circle, rgba(0, 255, 255, 0.2) 10%, black 80%); }
            100% { background: radial-gradient(circle, rgba(0, 255, 255, 0.4) 15%, black 90%); }
        }
    </style>
</head>
<body>

    <div class="background"></div>
    <div class="clock" id="clock">00:00:00</div>

    <script>
        function updateClock() {
            let now = new Date();
            let hours = String(now.getHours()).padStart(2, '0');
            let minutes = String(now.getMinutes()).padStart(2, '0');
            let seconds = String(now.getSeconds()).padStart(2, '0');
            document.getElementById('clock').textContent = `${hours}:${minutes}:${seconds}`;
        }

        setInterval(updateClock, 1000);
        updateClock(); // 页面加载时立即更新
    </script>

</body>
</html>
        
编辑器加载中
预览
控制台