Background Image in Keyframes: Ineffective in Firefox and Internet Explorer
The issue, as reported, concerns the absence of background-image animation in Firefox and Internet Explorer. This inconsistency arises from the fact that background-image is not an animatable property according to CSS specifications. Despite this, different browsers handle this discrepancy in varying ways.
Chrome (Webkit) displays the background image during animation, while Firefox and IE refrain from doing so. A source at oli.jp explains that this inconsistency may stem from a lack of widespread support for crossfading images in CSS. In the meantime, image sprites, background-position, or opacity can be used to simulate this effect.
Paradoxically, Firefox's behavior differs between transitions and animations involving background images. While it immediately displays the second image during transitions (as seen by hovering over the first div in the code snippet), it fails to do so during animations (as evidenced by hovering over the second div).
In conclusion, it is advisable to refrain from setting background-image within keyframes. Instead, opt for background-position or opacity, as suggested by oli.jp.
The above is the detailed content of Why Can't I Animate Background Images in Firefox and Internet Explorer?. For more information, please follow other related articles on the PHP Chinese website!