Если я сделаю это с высоты: 40px; на высоту: auto; , тогда он будет соскользнуть до высоты: 0; , а затем внезапно подпрыгнуть до правильной высоты. Javascript? < /P>
Код: Выделить всё
#child0 {
height: 0;
overflow: hidden;
background-color: #dedede;
-moz-transition: height 1s ease;
-webkit-transition: height 1s ease;
-o-transition: height 1s ease;
transition: height 1s ease;
}
#parent0:hover #child0 {
height: auto;
}
#child40 {
height: 40px;
overflow: hidden;
background-color: #dedede;
-moz-transition: height 1s ease;
-webkit-transition: height 1s ease;
-o-transition: height 1s ease;
transition: height 1s ease;
}
#parent40:hover #child40 {
height: auto;
}
h1 {
font-weight: bold;
}< /code>
The only difference between the two snippets of CSS is one has height: 0, the other height: 40.
Hover me (height: 0)
Some content
Some content
Some content
Some content
Some content
Some content
Hover me (height: 40)
Some content
Some content
Some content
Some content
Some content
Some content
Подробнее здесь: https://stackoverflow.com/questions/350 ... -using-css
Мобильная версия