【发布时间】:2014-05-13 00:50:51
【问题描述】:
我有一个 h1 元素及其子元素使用 CSS3 过渡动画。在 Chrome 甚至 IE 10+ 中一切正常,但在 Firefox 中,过渡效果仅在父元素中可见,而在子元素中不可见。
代码是这样的
<h1>G<span>eneric</span> D<span>ata</span> B<span>inder</span></h1>
其中 h1 元素和 span 元素都有自己的转换:
h1{
transition: all 800ms;
-moz-transition: all 800ms;
-webkit-transition: all 800ms;
-ms-transition: all 800ms;
-o-transition: all 800ms;
transition-property: line-height,width,font-size;
-moz-transition-property: line-height,width,font-size;
-ms-transition-property: line-height,width,font-size;
white-space: nowrap;
}
h1 span{
display:inline-block;
max-width:500px;
transition: all 800ms;
-moz-transition: all 800ms;
-webkit-transition: all 800ms;
-ms-transition: all 800ms;
-o-transition: all 800ms;
transition-property: opacity,max-width;
-moz-transition-property: opacity,max-width;
-ms-transition-property: opacity,max-width;
}
效果可以看这里:Generic Data Binder Site
这里的问题是 FireFox 渲染引擎中的错误或警告,还是我缺少某些关键,导致我犯了一个愚蠢的错误?
【问题讨论】:
-
我刚刚下载了 FF 29 Beta,但我仍然看到不正确的行为。字母不是平滑地淡出,而是在 H1 元素是唯一平滑过渡的地方立即消失。
-
你能提供一个 JSFiddle 吗?
-
CSS3 听起来不错,但事实是它还没有准备好……而且性能也不是很好。我建议查看 GSAP 动画工具并查看 CSS 与 JS 动画性能。 greensock.com/js/speed.html
-
您是否有理由为所有转换指定
all,然后选择性地仅在几个前缀上覆盖transition-property?此外,-ms-transition已不再使用,因此可以将其删除而不会产生任何实际后果。
标签: css firefox css-transitions css-animations