Developing a Responsive Digital Clock Using HTML5, CSS3, and JavaScript

Developing a Responsive Digital Clock Using HTML5, CSS3, and JavaScript

Photo from Unsplash

Screenshot from my Codepen featuring the clock we are trying to build

<div class="flex-item digit">
<div class="digit-inner">

</div>
<div class="digit-inner-lower">

</div>
</div>

Photo from Unsplash for illustration

<!--Seconds-->
<div class="flex-item digit">
<div class="digit-inner">
</div>
<div class="digit-inner-lower ">
</div>
</div>
<div class="flex-item digit">
<div class="digit-inner ">
</div>
<div class="digit-inner-lower">
</div>
</div>

let x = setInterval(function () {
countDown = new Date();
//displaying the seconds
getSecs=countDown.getSeconds();
let second1=-1, second2=-1
second1=Math.floor(getSecs/10);
second2=Math.floor(getSecs%10);
secondsFirstDigit=document.getElementsByClassName("days7")[0].getElementsByClassName("digit")[4];
dummy1=secondsFirstDigit.getElementsByClassName("digit-inner")[0]
dummy2=secondsFirstDigit.getElementsByClassName("digit-inner-lower")[0]
displayDigit(second1, dummy1, dummy2,secondsFirstDigit)

Conclusion