|
| 1 | +<!DOCTYPE html> |
| 2 | +<html lang="en"> |
| 3 | + <head> |
| 4 | + <meta charset="UTF-8" /> |
| 5 | + <meta http-equiv="X-UA-Compatible" content="IE=edge" /> |
| 6 | + <meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
| 7 | + <title>Document</title> |
| 8 | + <style> |
| 9 | + body { |
| 10 | + margin: 0; |
| 11 | + padding: 0; |
| 12 | + width: 100vw; |
| 13 | + height: 100vh; |
| 14 | + display: flex; |
| 15 | + align-items: center; |
| 16 | + justify-content: center; |
| 17 | + flex-direction: row; |
| 18 | + background-color: yellow; |
| 19 | + } |
| 20 | + #main { |
| 21 | + position: relative; |
| 22 | + width: 70vw; |
| 23 | + height: 10vw; |
| 24 | + border: 2px solid black; |
| 25 | + display: flex; |
| 26 | + flex-flow: row; |
| 27 | + justify-content: space-around; |
| 28 | + background-image: url('https://images.freeimages.com/images/large-previews/f12/wood-texture-1145610.jpg'); |
| 29 | + } |
| 30 | + .part { |
| 31 | + top: 11%; |
| 32 | + position: relative; |
| 33 | + width: 8vw; |
| 34 | + height: 8.6vw; |
| 35 | + display: flex; |
| 36 | + flex-direction: column; |
| 37 | + justify-content: top; |
| 38 | + } |
| 39 | + .block { |
| 40 | + width: 99%; |
| 41 | + height: 80%; |
| 42 | + padding-top: 0; |
| 43 | + margin-top: 0; |
| 44 | + background-color: #ceff0075; |
| 45 | + display: flex; |
| 46 | + justify-content: center; |
| 47 | + align-items: center; |
| 48 | + font-size: 4em; |
| 49 | + color: white; |
| 50 | + text-shadow: 1px 1px black; |
| 51 | + } |
| 52 | + .id { |
| 53 | + color: rgb(72, 255, 209); |
| 54 | + padding-top: 4%; |
| 55 | + text-align: center; |
| 56 | + text-shadow: 1px 1px black; |
| 57 | + font-size: 1.2vw; |
| 58 | + } |
| 59 | + </style> |
| 60 | + </head> |
| 61 | + <body> |
| 62 | + <div id="main"> |
| 63 | + <div class="part"> |
| 64 | + <div class="block" id="days"></div> |
| 65 | + <div class="id">DAYS</div> |
| 66 | + </div> |
| 67 | + <div class="part"> |
| 68 | + <div class="block" id="hrs"></div> |
| 69 | + <div class="id">HOURS</div> |
| 70 | + </div> |
| 71 | + <div class="part"> |
| 72 | + <div class="block" id="mins"></div> |
| 73 | + <div class="id">MINUTES</div> |
| 74 | + </div> |
| 75 | + <div class="part"> |
| 76 | + <div class="block" id="s"></div> |
| 77 | + <div class="id">SECONDS</div> |
| 78 | + </div> |
| 79 | + </div> |
| 80 | + |
| 81 | + <script> |
| 82 | + var countDownDate = new Date('Nov 1, 2021 00:00:00').getTime() |
| 83 | + var x = setInterval(function () { |
| 84 | + var now = new Date().getTime() |
| 85 | + |
| 86 | + var distance = countDownDate - now |
| 87 | + |
| 88 | + var days = Math.floor(distance / (1000 * 60 * 60 * 24)) |
| 89 | + var hours = Math.floor( |
| 90 | + (distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60) |
| 91 | + ) |
| 92 | + var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)) |
| 93 | + var seconds = Math.floor((distance % (1000 * 60)) / 1000) |
| 94 | + document.getElementById('days').innerHTML = days |
| 95 | + document.getElementById('hrs').innerHTML = hours |
| 96 | + document.getElementById('mins').innerHTML = minutes |
| 97 | + document.getElementById('s').innerHTML = seconds |
| 98 | + if (distance < 0) { |
| 99 | + clearInterval(x) |
| 100 | + document.getElementById('demo').innerHTML = 'EXPIRED' |
| 101 | + } |
| 102 | + }, 1000) |
| 103 | + </script> |
| 104 | + </body> |
| 105 | +</html> |
0 commit comments