Digital Clock in JavaScript with HTML, CSS and javaScript in hindi

 


Download HTML Code for Digital Clock - Click here

Download CSS Code for Digital Clock - Click here

Html Code of Digital Clock

<!doctype html>

<htm lang="en" dir="ltr">

<head>

<meta charset="utf-8">

<title>Digital Clock</title>

<link rel="stylesheet" href="clock.css">

</head>

<body>

<div class="digital">

<div class="clock">

<div id="time"><!--12:00:00 AM--></div>

</div>

<span></span>

<span></span>

</div>

<script>

setInterval(()=>{

const time = document.querySelector("#time");

let date = new Date();

let hours = date.getHours();

let minutes = date.getMinutes();

let seconds = date.getSeconds();

let day_night = "AM"

if(hours > 12){

day_night = "PM";

hours = hours - 12;

}

if(hours < 10){

hours = "0" + hours;

}

if(minutes < 10){

minutes = "0" + minutes;

}

if(seconds < 10){

seconds = "0" + seconds;

}

time.textContent = hours+":"+minutes+":"+seconds+" "+day_night;

});

</script>

</body>

</html>

CSS Code for Digital Clock

*{

  margin: 0;

  padding: 0;

  font-family: 'Poppins', sans-serif;

}

html,body{

  display: grid;

  height: 100%;

  place-items: center;

  background: #2e2e45;

}

.digital{

  height: 100px;

  width: 360px;

  position: relative;

  background: linear-gradient(135deg, #14ffe9, #ffeb3b, #ff00e0);

  border-radius: 10px;

  cursor: default;

  animation: animate 1.5s linear infinite;

}

.digital .clock,

.digital span{

  position: absolute;

  top: 50%;

  left: 50%;

  transform: translate(-50%, -50%);

}

.digital .clock{

  z-index: 999;

  height: 85px;

  width: 345px;

  background: #2d2f38;

  border-radius: 6px;

  text-align: center;

}

.clock #time{

  line-height: 85px;

  color: #fff;

  font-size: 50px;

  font-weight: 600;

  letter-spacing: 1px;

  background: linear-gradient(135deg, #14ffe9, #ffeb3b, #ff00e0);

  -webkit-background-clip: text;

  -webkit-text-fill-color: transparent;

  animation: animate 1.5s linear infinite;

}

@keyframes animate {

  100%{

    filter: hue-rotate(360deg);

  }

}

.digital span{

  height: 100%;

  width: 100%;

  border-radius: 10px;

  background: inherit;

}

.digital span:first-child{

  filter: blur(7px);

}

.digital span:last-child{

  filter: blur(20px);

}

कोई टिप्पणी नहीं

टिप्पणी: केवल इस ब्लॉग का सदस्य टिप्पणी भेज सकता है.

MS Excel to WhatsApp Bulk Message in single Click

Excel to WhatsApp Bulk Message VBA Code File Download VBA Note Pad File - Click here Download Excel Practice File - Click here Copy Code her...

Blogger द्वारा संचालित.