html - Internet Explorer 10 css3 过渡高度不会随父填充底部值发生

标签 html css internet-explorer internet-explorer-10

我有一个容器 div,为了使其与窗口宽度相关(并保持方形比例)具有以下 css:

JSFIDDLE

#container {
    width:30%;
    height:0;
    padding-bottom:30%;
    position: relative;
}

它有一个固定高度和宽度的内部 div,悬停时应该变为 100%(两者)并带有过渡:

#inside {
    position:absolute;
    top:0;
    left:0;
    width:30px;
    height:30px;
    -webkit-transition: width 0.4s, height 0.4s;
    -moz-transition: width 0.4s, height 0.4s;
    -o-transition: width 0.4s, height 0.4s;
    -ms-transition: width 0.4s, height 0.4s;
    transition: width 0.4s, height 0.4s;
}

#container:hover #inside {
    width: 100%;
    height:100%;
}

在 Chrome,Firefox,Opera,Safari 中没有问题。然而,Internet Explorer 10 不会转换高度值,因此会发生跳跃。 有没有一种方法可以在不触及 div 的结构(父 div 中的填充底部)的情况下为 ie10 解决这个问题?

最佳答案

尝试对 #inside 进行以下更改:

  • 添加 min-width: 30px;min-height: 30px;
  • width: 30px; 更改为 width: 1%; 并将 height: 30px; 更改为 height: 1%;

#container:hover #inside {
    height: 100%;
    width: 100%;
}
#container {
    background: black;
    height: 0;
    padding-bottom: 30%;
    position: relative;
    width: 30%;
}
#inside {
    background: pink;
    height: 1%;
    left: 0;
    min-height: 30px;
    min-width: 30px;
    position: absolute;
    top: 0;
    -webkit-transition: width 0.4s, height 0.4s;
    -moz-transition: width 0.4s, height 0.4s;
    -o-transition: width 0.4s, height 0.4s;
    -ms-transition: width 0.4s, height 0.4s;
    transition: width 0.4s, height 0.4s;
    width: 1%;
}
<div class="out" id="container">
    <div id="inside"></div>
</div>

JS fiddle : http://jsfiddle.net/r8rjhy9v/

关于html - Internet Explorer 10 css3 过渡高度不会随父填充底部值发生,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26886958/

相关文章:

javascript - 如何使特定的文本值以不同的文本响应

jQuery 幻灯片以不透明度阻止动画

html - 使用 CSS 最小限度地包围文本

jquery - 使用户能够拥有自定义配置文件的最佳方式 - 例如 about.me 个人资料

javascript - ie9 中的 Angular js 问题

internet-explorer - 有时添加喜欢的名字有问题

javascript - hover 后隐藏的 div 和 stay 出现

javascript - 获得 childnodes child 直到没有

javascript - 为什么IE需要我点击两次

javascript - 如何在此 PHP 页面中用简单的 HTML 选择替换此价格 slider ?选择选项可以传递 2 个值(最低价格和最高价格)吗?