css - Transitions on the display: property -


i'm designing kind of css 'mega dropdown' menu - normal css-only dropdown menu, 1 contains different types of content.

at moment, appears css3 transitions don't apply 'display' property, i.e. can't sort of transition display: none display: block (or combination).

can think of way second-tier menu above example 'fade in' when hovers on 1 of top level menu items?

i'm aware can use transitions on visibility: property, can't think of way utilise effectively.

i've tried using height failed miserably.

i'm aware it's trivial achieve using javascript, wanted challenge myself use css , think i'm coming little short.

all , suggestions welcome.

you can concatenate 2 transitions or more, , visibility comes handy time.

div {    border: 1px solid #eee;  }  div > ul {    visibility: hidden;    opacity: 0;    transition: visibility 0s, opacity 0.5s linear;  }  div:hover > ul {    visibility: visible;    opacity: 1;  }
<div>    <ul>      <li>item 1</li>      <li>item 2</li>      <li>item 3</li>    </ul>  </div>

(don't forget vendor prefixes transition property)

more details in this article


Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -