j-man86 j-man86 - 1 month ago 29
CSS Question

css3 background-size transition animation in Webkit doesn't work... Bug? Or wrong syntax?

http://jsfiddle.net/ubcka/14/

Animating the background-size property doesn't seem to be working in Chrome or Safari.

Thanks!

div {
width: 161px;
height: 149px;

background: url(http://3.bp.blogspot.com/_HGPPifzMEZU/Rw4ujF12G3I/AAAAAAAAAWI/bc1ppSb6eKA/s320/estrelas_09.gif) no-repeat center center;
background-size: 50% 50%;

-webkit-transition: background-size 2s ease-in;
-moz-transition: background-size 2s ease-in;
transition: background-size 2s ease-in;

}

div:hover {
background-size: 100% 100%;
}

Answer

You should check the browser version and whether it supports both background-size and transition. If the former, but not the latter use:

transition: background-size 2s ease-in;
-moz-transition: background-size 2s ease-in;
-ms-transition: background-size 2s ease-in;
-o-transition: background-size 2s ease-in;
-webkit-transition: background-size 2s ease-in;
Comments