Grow your CSS skills. Land your dream job.

Last updated on:

Scale on Hover with Transition

Bring your own prefixes!

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

Comments

  1. 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

      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. 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
      Permalink to comment#

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

  4. Hello,

    I am trying to scale small icons using this method. It works for moz,firefox, chrome, safari.. however couldnt get it to work for ie7-8. I think there is no direct support for such. Do you have any javascript or similar that does similar job?

  5. To be patched. It works perfectly fine in all major browsers now. :)

  6. Rekaut
    Permalink to comment#

    was very good sample , it helped me a lot . thank you very much.

  7. Really liked this one Chris. Looks great, cheers!

  8. Alisher
    Permalink to comment#

    nice tricks with image – thank you guys (beginner)

  9. Permalink to comment#

    I was stuck with smooth scaling for 2 hours – and here I found this short and sweet solution. Thank you so much!

  10. Permalink to comment#

    Hi there,
    nice effect, I am using it as a main rollover effect in a website now, and used it before too but, can’t have my head around solving a problem. Meanwhile the transition runs, other elements in the view start doing some slightly perceptible but very annoying undesired movements too. Sometimes they are other images, other times text goes slightly bolder, and ALWAYS the image running the transition has an start and an end blurry moment, very short but very horrible. What am I missing here?

  11. dhaval
    Permalink to comment#

    “-webkit-transition: .6s ease-in-out fade ” this code is not working in google chrome.In mozilla its work fine.Please help me out.

  12. Hey, it looks like it is the order of the parameters,
    transition: [transition-property] [transition-duration] [transition-timing-function] [transition-delay];
    try :
    -webkit-transition: opacity .6s ease-in-out
    And, as far as I am aware ‘fade’ is not a CSS property so no CSS transition can run on it, this is why I modified your rule from ‘fade’ to opacity.
    and there are thousands of articles about CSS transitions ou there, but the following is one of the best :) :

    http://css-tricks.com/almanac/properties/t/transition/

  13. Permalink to comment#

    Reference link is dead.

Leave a Comment

Posting Code

Markdown is supported in the comment area, so you can write inline code in backticks like `this` or multiline blocks of code in in triple backtick fences like ```this```. You don't need to escape code in backticks, Markdown does that for you.

Sadly, it's kind of broken. WordPress only accepts a subset of HTML in comments, which makes sense, because certainly some HTML can't be allowed, like <script> tags. But this stripping happens before the comment is processed by Markdown (via Jetpack). It seems to me that would be reversed, because after Markdown processes code in backticks, it's escaped, thus safe. If you think you can fix this issue, get in touch!

If you need to make sure the code (typically HTML) you post absolutely posts correctly, escape it and put it within <pre><code> tags.

Current ye@r *

*May or may not contain any actual "CSS" or "Tricks".