I want the display:block
to fade in
HTML:
<div>Fade</div>
CSS:
div{display:none;transition:2s;}
div:hover{display:block;}
Somehow it doesnt work , is there any other way to achieve this effect?
You cannot transition the display
property. Instead you should transition the opacity
property.
The underlying reason for this has to do with the browsers rendering pipeline. It needs to properly layout the page before transitioning and an element with 1display: none;` has no layout (thus cannot be transitioned).