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.
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.
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.
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.
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.
You can't transition from auto
to 20px
. Set it explicitly to 0px
in #inner {}
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With