Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Style Countdown Timer Change

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #152450

    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

    http://codepen.io/CarraraWebsiteSolutions/pen/uxqFg

    #152452
    pils87
    Participant

    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";
    
    #152463

    Will give it a go

    #152537
    Josh
    Participant

    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.

    #152547

    Thanks that ways what I am after. Gives me more options of styling it now.

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.