Transition: does not work in Firefox and Opera

I just can't get this to work. I am sure it is possible.

This is just an example. I want the inner div to move down with a transition effect.

<div id="outer">
    <div id="inner"></div>
</div>

<style type="text/css">       
    #outer
    {
        width:200px; 
        height:200px; 
        background-color:Yellow;
    }

    #inner
    {
        position:relative;
        -webkit-transition: top .4s ease-out;
        -moz-transition: top .4s ease-out;
        width:50px; 
        height: 100px; 
        background-color:Red;
    }

    #inner:hover
    {
        top:20px;
    }

</style>

It works fine f.ex. in Chrome, but not Firefox 14 and Opera 12 (with the corresponding -o transition). I tried the only transition property with no effect.

+5
source share
1 answer

You cannot go from autoto 20px. Set it explicitly to 0pxin #inner {}.

+10
source