CSS从高度自动过渡到高度75%

前端之家收集整理的这篇文章主要介绍了CSS从高度自动过渡到高度75%前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
参见英文答案 > How can I transition height: 0; to height: auto; using CSS?45个
我做了一个css过渡,从高度自动到高度:75%.

css-过渡:

-webkit-transition: height 0.5s ease-in-out;
-moz-transition: height 0.5s ease-in-out;
-o-transition: height 0.5s ease-in-out;
transition: height 0.5s ease-in-out;

但它不适用于IE和Firefox.我在谷歌上发现了一些帖子,但无法找到解决方案.

谢谢你的帮助.

解决方法

要使用%和auto,您可以尝试使用这样的min-height:
div {
  -webkit-transition: height 1s ease-in-out;
  -moz-transition: all 1s ease-in-out;
  -o-transition: all 1s ease-in-out;
  transition: all 1s ease-in-out;
}
div:hover {
  min-height:75%;
}

检查这个Demo Fiddle

在Chrome 31中测试 – Firefox 26

猜你在找的CSS相关文章