<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Обратный отсчет до Нового Года</title>
<style>
body {
margin: 0;
padding: 0;
background-color: #0d1b2a;
color: white;
font-family: 'Arial', sans-serif;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
}
.countdown-container {
background-color: #1c1f29;
border-radius: 10px;
padding: 30px;
text-align: center;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
width: 450px;
}
.title {
font-size: 24px;
margin-bottom: 25px;
color: #e0e1dd;
}
.countdown {
display: flex;
justify-content: space-between;
margin-bottom: 25px;
}
.time-block {
text-align: center;
}
.time-value {
font-size: 32px;
font-weight: bold;
background-color: #2f323c;
border-radius: 5px;
padding: 10px;
margin-bottom: 5px;
color: #ff5155;
text-shadow: #ff5155 1px 1px 10px;
}
.time-label {
font-size: 14px;
color: #ffd652;
}
.date-info {
font-size: 16px;
color: #e0e1dd;
margin-bottom: 10px;
background: #2f323c;
border-radius: 7px;
Padding: 2px 4px;
}
.target-date {
font-size: 16px;
color: #a8b3c0;
}
</style>
</head>
<body>
<div class="countdown-container">
<div class="title" style= box-shadow: 0 4px 8px #ffd652; padding: 15px; max-width: 300px; margin: 0 auto;"> <h2 align="center" style="color: #ffd652; text-shadow: #ffd652 1px 1px 10px; margin: 0; font-size: 18px;"><b>До Нового Года</b></div>
<div class="countdown">
<div class="time-block">
<div class="time-value" id="days">52</div>
<div class="time-label">ДНЕЙ</div>
</div>
<div class="time-block">
<div class="time-value" id="hours">05</div>
<div class="time-label">ЧАСОВ</div>
</div>
<div class="time-block">
<div class="time-value" id="minutes">08</div>
<div class="time-label">МИНУТ</div>
</div>
<div class="time-block">
<div class="time-value" id="seconds">21</div>
<div class="time-label">СЕКУНД</div>
</div>
</div>
<div class="date-info" id="current-date">Сегодня: 9 ноября, 18:51:38</div>
<div class="target-date">До 1 января 2026 года</div>
</div>
<script>
// Функция для обновления обратного отсчета
function updateCountdown() {
const now = new Date();
const targetYear = 2026;
const newYearDate = new Date(`January 1, ${targetYear} 00:00:00`);
// Разница во времени между текущим моментом и Новым Годом
const timeDiff = newYearDate - now;
// Расчет дней, часов, минут и секунд
const days = Math.floor(timeDiff / (1000 * 60 * 60 * 24));
const hours = Math.floor((timeDiff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
const minutes = Math.floor((timeDiff % (1000 * 60 * 60)) / (1000 * 60));
const seconds = Math.floor((timeDiff % (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',
hour: '2-digit',
minute: '2-digit',
second: '2-digit'
};
document.getElementById('current-date').textContent = `Сегодня: ${now.toLocaleDateString('ru-RU', options)}`;
}
// Запуск обратного отсчета при загрузке страницы
updateCountdown();
// Обновление каждую секунду
setInterval(updateCountdown, 1000);
</script>
</body>
</html>