Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

transition: top not working in Firefox and Opera

I just cannot get this to work. I am pretty sure it must be possible.

This is just an example. I want the inner div to move down with 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 respective -o-transition). I tried the sole "transition" property without effect.

like image 605
AGuyCalledGerald Avatar asked Jul 26 '12 16:07

AGuyCalledGerald


People also ask

Why Transition property is not working?

The reason for this is, display:none property is used for removing block and display:block property is used for displaying block. A block cannot be partly displayed. Either it is available or unavailable. That is why the transition property does not work.

Is WebKit Deprecated?

Deprecated: This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes.

What is the function of transition button?

Transitions enable you to define the transition between two states of an element. Different states may be defined using pseudo-classes like :hover or :active or dynamically set using JavaScript.

What is transition all in CSS?

CSS transitions allows you to change property values smoothly, over a given duration. Mouse over the element below to see a CSS transition effect: CSS. In this chapter you will learn about the following properties: transition.


1 Answers

You can't transition from auto to 20px. Set it explicitly to 0px in #inner {}.

like image 167
Prinzhorn Avatar answered Sep 30 '22 23:09

Prinzhorn