ГДЗ.РУ
Мой сайт с домашними заданиями☺
До Нового года
осталось:
00
Дней
00
Часов
00
Минут
00
Секунд
const countdown = document.querySelector('.countdown'); const targetDate = new Date('2024-12-31T23:59:59'); function updateCountdown() { const now = new Date(); const remainingTime = targetDate - now; const days = Math.floor(remainingTime / (1000 * 60 * 60 * 24)); const hours = Math.floor((remainingTime % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); const minutes = Math.floor((remainingTime % (1000 * 60 * 60)) / (1000 * 60)); const seconds = Math.floor((remainingTime % (1000 * 60)) / 1000); document.getElementById('days').innerText = days.toString().padStart(2, '0'); document.getElementById('hours').innerText = hours.toString().padStart(2, '0'); document.getElementById('minutes').innerText = minutes.toString().padStart(2, '0'); document.getElementById('seconds').innerText = seconds.toString().padStart(2, '0'); } // Обновляем счетчик каждую секунду setInterval(updateCountdown, 1000);
body { background-color: #4285b4; height: 100vh; display: grid; justify-content: center; font-family: 'Baloo Tamma', cursive; transition: 4s; } p { height:auto; color: #fcfcee; /*margin-top: 5vh;**/ padding-top:10vh; padding-bottom:10vh; position:center; align-content: center; text-align: center; font-size: 5vw; flex-direction: column; font-style:italic; /*margin-bottom:10vh;*/ } .img{ flex-direction:column; display: flex; } .countdown { flex-direction:row; margin-left:2vw; margin-right:2vw; margin-bottom:1vh; display: flex; justify-content: center; font-family: 'Arial', sans-serif; } .countdown-item { position:center; margin: 20px; text-align: center; /*padding-bottom: 10vh;*/ padding-top:1vh; } .countdown-item span { display: block; position:center; font-size: 5vw; /*padding-top:0px;*/ } .label { padding-top: 100px; position:center; font-size: 2vw; color: #999; } .snow { width: 100vw; height: 150vh; border: 1px solid rgba(255, 255, 255, 0.1); background-image: url("data:image/svg+xml,%3Csvg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 50 50' style='enable-background:new 0 0 50 50%3B' xml:space='preserve'%3E%3Cstyle type='text/css'%3E.st1%7Bopacity:0.3%3Bfill:%23FFFFFF%3B%7D.st3%7Bopacity:0.1%3Bfill:%23FFFFFF%3B%7D%3C/style%3E%3Ccircle class='st1' cx='5' cy='8' r='1'/%3E%3Ccircle class='st1' cx='38' cy='3' r='1'/%3E%3Ccircle class='st1' cx='12' cy='4' r='1'/%3E%3Ccircle class='st1' cx='16' cy='16' r='1'/%3E%3Ccircle class='st1' cx='47' cy='46' r='1'/%3E%3Ccircle class='st1' cx='32' cy='10' r='1'/%3E%3Ccircle class='st1' cx='3' cy='46' r='1'/%3E%3Ccircle class='st1' cx='45' cy='13' r='1'/%3E%3Ccircle class='st1' cx='10' cy='28' r='1'/%3E%3Ccircle class='st1' cx='22' cy='35' r='1'/%3E%3Ccircle class='st1' cx='3' cy='21' r='1'/%3E%3Ccircle class='st1' cx='26' cy='20' r='1'/%3E%3Ccircle class='st1' cx='30' cy='45' r='1'/%3E%3Ccircle class='st1' cx='15' cy='45' r='1'/%3E%3Ccircle class='st1' cx='34' cy='36' r='1'/%3E%3Ccircle class='st1' cx='41' cy='32' r='1'/%3E%3C/svg%3E"); background-position: 0px 0px; animation: animatedBackground 10s linear infinite; } .snow div { width: 100vw; height: 100vh; background-image: url("data:image/svg+xml,%3Csvg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 50 50' style='enable-background:new 0 0 50 50%3B' xml:space='preserve'%3E%3Cstyle type='text/css'%3E.st1%7Bopacity:0.7%3Bfill:%23FFFFFF%3B%7D.st3%7Bopacity:0.1%3Bfill:%23FFFFFF%3B%7D%3C/style%3E%3Ccircle class='st3' cx='4' cy='14' r='1'/%3E%3Ccircle class='st3' cx='43' cy='3' r='1'/%3E%3Ccircle class='st3' cx='31' cy='30' r='2'/%3E%3Ccircle class='st3' cx='19' cy='23' r='1'/%3E%3Ccircle class='st3' cx='37' cy='22' r='1'/%3E%3Ccircle class='st3' cx='43' cy='16' r='1'/%3E%3Ccircle class='st3' cx='8' cy='45' r='1'/%3E%3Ccircle class='st3' cx='29' cy='39' r='1'/%3E%3Ccircle class='st3' cx='13' cy='37' r='1'/%3E%3Ccircle class='st3' cx='47' cy='32' r='1'/%3E%3Ccircle class='st3' cx='15' cy='4' r='2'/%3E%3Ccircle class='st3' cx='9' cy='27' r='1'/%3E%3Ccircle class='st3' cx='30' cy='9' r='1'/%3E%3Ccircle class='st3' cx='25' cy='15' r='1'/%3E%3Ccircle class='st3' cx='21' cy='45' r='2'/%3E%3Ccircle class='st3' cx='42' cy='45' r='1'/%3E%3C/svg%3E"); background-position: 0px 0px; animation: animatedBackground 15s linear infinite; } @keyframes animatedBackground { 0% { background-position: 0 0; } 100% { background-position: 0vh 100vw; } }
Results:
До Нового года
осталось:
00
Дней
00
Часов
00
Минут
00
Секунд