A Web Design Community curated by Chris Coyier

A little dab'll do ya

Code Snippets

Home » Code Snippets » CSS » Scale on Hover with Webkit Transition Submit one!

Scale on Hover with Webkit Transition

This only works on webkit based browsers (Chrome, Safari). It degrades gracefully for non-webkit browsers (no change is seen, rather than an unanimated size bump).

#blah { -webkit-transition: all .2s ease-in-out; }
#blah:hover { -webkit-transform: scale(1.1); }

Reference URL

Subscribe to The Thread

  1. Glenn N. says:

    I was able to achieve the enlarging in Firefox by doing -moz-transition: scale(1.4); but the animation part does not work. Does Firefox have an equivalent to the ease-in-out?

    • Alhadis says:

      At the moment, the current stable release of Firefox doesn’t support transitions, no.

      But the nightly build of Firefox (3.7) is supposed to have support for transitions, under the vendor prefix “-moz-transition:”. Since 3.7 isn’t a stable build yet, we’ll just have to wait in the meantime. =)

      The CSS3 spec for transitions might actually be finalised by the time Firefox 3.7 is released to public, so there mightn’t even be a need for using the vendor-specific prefix.

  2. d i l i p says:

    Thank you so much for this! :)

  3. I have a question about this technique.

    I’m trying to employ the same thing for a nav ul of mine, but the issue is when I hover and the current link scales, it covers up the other links, plus it does not returning smoothly to the beginning; it jumps. I don’t have a clue as how to make the other nav elements move, or be pushed out of the way, by the nav link that is scaling currently, or how to fix the the jumpieness of the link when I mouse away from it. I’m very new to web design (6 months) so my knowledge is swiss cheese right now. I would appreciate some help on the issue, as I’m a little lost currently.

    Here is my css for ul. I’m sure I’m missing some obvious stuff, so any help will be much appreciated!

    #intro-container ul {
    font-size: 20px;
    float: right;
    margin: 20px 0;
    padding: 80px 0 0 0;
    text-align: right;
    list-style: none;
    }

    #intro-container ul li {
    }

    #intro-container ul li a {
    display: block;
    font-size:45px;
    padding: 5px;
    -webkit-transition: -webkit-transform 0.5s ease;
    -moz-transition: -moz-transform 0.5s ease;
    transition: transform 0.5s ease;
    }

    #intro-container ul li a:hover {
    -webkit-transform: scale(1.25);
    -moz-transform: scale(1.25);
    -o-transform: scale(1.25);
    transform: scale(1.25);
    -webkit-transform-origin: top right;
    -moz-transform-origin: top right;
    -o-transform-origin: top right;
    transform-origin: top right;
    }

    Again, thank you in advance for any assistance anybody is willing to provide. This stuff is confusing for a newbie!

    Richard Nash,
    Los Angeles

    • Hernan Chiosso says:

      You are trying to scale the text? Perhaps you should just transition the font-size property.

It's Your Turn

At this moment, you have an awesome opportunity* to be the person your mother always wanted you to be: kind, helpful, and smart. Do that, and we'll give you a big ol' gold star for the day (literally).

Posting tips:
  • You can use basic HTML
  • When posting code, please turn all
    < characters into &lt;
  • If the code is multi-line, use
    <pre><code></code></pre>
Thank you,
--- The Management ---