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.

Possible to “em” instead of “px” for this font-size animation

  • # January 17, 2013 at 8:34 am

    Here is the current code, using pixels. It animates just fine.

    fontSize: $(‘span.heart’).css(‘fontSize’) == ‘150px’ ? ’50px’ : ‘150px’}, 500, animateHeart);

    I tried using ems like this. But the animation does not work.

    fontSize: $(‘span.heart’).css(‘fontSize’) == ‘2em’ ? ‘1em’ : ‘2em’}, 500, animateHeart);


    # January 17, 2013 at 9:11 am

    This reply has been reported for inappropriate content.

    Inspect the heartbeat element on Chrome and you will see the font is changing but only after 2 so it is changing like:

    2.12412412 etc

    This might be where your problem lies

Viewing 2 posts - 1 through 2 (of 2 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