A few things to clean up first
- You can't transition from
display: none to display: block. Just can't happen. I would recommend transitioning opacity: 0 to opacity: 1 instead for a fade-in effect
- Your
transition: top 1s ease-out 1.5s call will only animate top attribute. That's what the top means in that line. You can add multiple targets via a comma delimited list, e.g. top 1s ease-out, opacity 1s ease-out etc. etc. Alternatively, you can just write the rule as transition: 1s ease-out and it will animate all changes (but this may have some minor performance hits as opposed to selecting the attributes to animate).
- When using CSS transitions you must have an initial and a destination state or the animation won't work. An example in your code would be:
.result{
width: 200px;
height: 300px;
top: 0;
background: #ff0000;
}
.result #add{
opacity: 0;
position: relative;
}
.result:hover #add{
-webkit-transition: 1s ease-out 1.5s;
-moz-transition: 1s ease-out 1.5s;
transition: 1s ease-out 1.5s;
opacity: 1;
top: 40px;
}
And that, as written, should work for you.
Displayproperty can't be animated withtransitioninstead you can useopacity.