- This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
Viewing 5 posts - 1 through 5 (of 5 total)
- The forum ‘JavaScript’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › JavaScript › Style Countdown Timer Change
Hi.
I have a countdown timer js code that I am working on but it is hard to style it. I would like to know if there is away to make the value in html so can easier style it it is a bit hard in js.
Trying to style the count down number different to the value
I’m a newb so not sure if this is the way to go but you can just edit this part in the js:
countdown.innerHTML = days + " Days " + hours + " Hours "
+ minutes + " Minutes " + seconds + " Seconds";
For example adding a span arround “Days”:
countdown.innerHTML = "<span>" + days + "</span> Days " + hours + " Hours "
+ minutes + " Minutes " + seconds + " Seconds";
Will give it a go
What @pils87 said, but taking it a step further to separate the text from the numbers, for even more granular styling: http://codepen.io/JoshBlackwood/pen/lukjq
Please pardon the garish colors, just wanted to make the point.
Thanks that ways what I am after. Gives me more options of styling it now.