<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Flip Clock</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #282c36;
font-family: Arial, sans-serif;
}
.clock {
display: flex;
gap: 10px;
}
.digit {
position: relative;
width: 100px;
height: 150px;
background-color: #333;
color: #fff;
font-size: 5rem;
text-align: center;
line-height: 150px;
border-radius: 10px;
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}
</style>
</head>
<body>
<div class="clock">
<div class="digit" id="hours">00</div>
<div class="digit" id="minutes">00</div>
<div class="digit" id="seconds">00</div>
</div>
<script>
function updateClock() {
const now = new Date();
const hours = String(now.getHours()).padStart(2, '0');
const minutes = String(now.getMinutes()).padStart(2, '0');
const seconds = String(now.getSeconds()).padStart(2, '0');
document.getElementById('hours').textContent = hours;
document.getElementById('minutes').textContent = minutes;
document.getElementById('seconds').textContent = seconds;
}
setInterval(updateClock, 1000);
updateClock();
</script>
</body>
</html>
翻页时钟代码
于 2025-03-08 16:57:50 首次发布