Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simple CSS transition does not execute

Demo

<a href="#">hover</a>
<p>Text here</p>

I want the <p> to fade in and slide in when the <a> is hovered. Problem is, with the CSS in the demo, the <p> just "pops" in rather than animating.

like image 935
Stephen Collins Avatar asked Jul 18 '13 14:07

Stephen Collins


2 Answers

The transition shorthand doesn’t support multiple properties in the same place:

transition: max-height .5s ease, opacity .5s ease;

You also need overflow: hidden to make it look like it’s sliding. Updated demo

like image 176
Ry- Avatar answered Nov 15 '22 05:11

Ry-


You need to comma seperate the properties you want to transition:

p {
    opacity: 0;
    max-height: 0;
    transition: max-height .5s ease, opacity .5s ease;    
}

http://jsfiddle.net/pZngX/

like image 44
Chris Laarman Avatar answered Nov 15 '22 07:11

Chris Laarman