Today's day 13 Goal is to Build and learn by creating a Countdown timer in Html & CSS from YT Tutorial.
HTML
-
CSS
1. how to give background colour property in CSS?
- Write the following code.
background-color: coral;
JavaScript
1. how to get time left in days,minutes,seconds in JavaScript?
- Write the following code.
const days = Math.floor(timespan/day);
const hours = Math.floor((timespan%day)/hour);
const minutes =Math.floor((timespan%hour)/minute);
const seconds = Math.floor((timespan%minute)/second);
how to return data from JavaScript to html element?
- Write the following code.
timeleft.innerHTML= days+'days '+hours+'hours '+minutes+'minutes '+seconds+'seconds';
}
Conclusion
I have Discussed and practiced the following,
Background colour property in CSS
Time left in days,minutes,seconds in JavaScript.
Return data from JavaScript to html element.
I Have successfully built Birthday countdown timer in 2 days by learning in open source using stack HTML, CSS, JavaScript.
My Code:
Source: YT
Author: Dheeraj.y