All Posts by Email, Once a Week

Media Temple logo

CSS-Tricks is brought to you in part by Media Temple, the web hosting that we both use and recommend.

Increment counter formatting

  • # December 1, 2012 at 5:09 pm

    Basically the counter I have created for a website seems to be working as I want it to (I can edit it to do what I want) – but for some reason when I increment it by decimals i.e. 0.1, 0.2, 0.3 etc the formatting glitches?

    You can view the counter live at

    Here is the code behind the counter:



    Any help is much appreciated!

    # December 5, 2012 at 6:58 am

    Can anyone help with this at all?


    # December 5, 2012 at 7:09 am

    I’m not seeing a counter on the link you provided.

    EDIT: Wow that’s hard to see.

    # December 5, 2012 at 7:14 am

    I don’t see the point behind having it on your website anyway as it’s not really a true reflection on the amount you’re exactly saving to be honest…

    But i just ran your code through [JSLint]( “”) on the JSFiddle website and it threw back a few errors.

    Try changing this;

    var number = < ?=(int)((time()-1262325600)/150);?>;

    To this;

    var number = (int)((time()-1262325600)/150);

    This is what I got – Here

    # December 6, 2012 at 5:40 pm

    > I’m not seeing a counter on the link you provided.

    EDIT: Wow that’s hard to see.

    It isn’t live hence it being hard to see, but thanks for your lack of help!

    Thanks Watson… I will give it a try and see if it begins to sort it out.

    It is possible to work out an estimate by taking the average tonnes of co2 they save over the last 3 years. I only design what they want though, so I won’t defend the need of it!


Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.

There's a whole bunch of content on CSS-Tricks.

Search for Stuff   •   Browse the Archives

Get the Newsletter ... or get the RSS feed