How are you all Hope everyone is well. I'm fine too. Today I have come to you with a beautiful tutorial. And that is how you can make a digital clock through programming. This is a tutorial made with my talent, coding skills, hope you like it. Let's share the tutorial with you step by step.
This tutorial is divided into three steps in total. And that is:-
- HTML Part
- CSS Part
- JavaScript Part
HTML means Hyper Text Markup Language. First I have a file named "index.html" inside a folder. Then open this file in "VS CODE" and code inside it like the above screenshot. Here create a folder named CSS for CSS and inside it create a CSS file "style.css". And link to "index.html" as style. And create a folder named js for JavaScript. And create a file named "main.js" inside it. And link to "index.html" through script tag. And the body tag doesn't have a div tag for the clock.
For the clock through HTML, I took the div named .clock and designed it with CSS. Here we design the body first. Position, colour, text size, bold text, letter distance, background colour, padding, border radius etc. are designed for clock.
JavaScript does not have a function called showTime(). Then inside this function hours, minutes, seconds, and sessions are not included in separate variables. Then there are some conditions to show the time properly. Let's pass the time generated through our JavaScript to the id MyClockDisplay which we have given an id with HTML. And reload the function every second with setTimeout(showTime, 1000). And with that done, our desired digital clock.
So friends, I have shared with you step by step how to make a digital clock. Thanks everyone for reading the post. Hope everyone likes the post. And if you have any comment you can tell through comment.
X/Twitter share link
https://x.com/Mahabubcmt8Alam/status/1804176700009517429
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit