Animating the background-size property doesn't seem to be working in Chrome or Safari.
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%; transition: background-size 2s ease-in; -moz-transition: background-size 2s ease-in; -web-kit-transition: background-size 2s ease-in } div:hover { background-size: 100% 100% }
<div> hey </div>
http://jsfiddle.net/ubcka/14/
Animation Duration Not Set By default, a CSS animation cycle is zero seconds long. To override this, add an animation-duration rule to your targeted element with a seconds value, in the same block as animation-name. Below, try removing the comments around animation-duration to fix the animation.
When we want to use transition for display:none to display:block, transition properties do not work. The reason for this is, display:none property is used for removing block and display:block property is used for displaying block. A block cannot be partly displayed. Either it is available or unavailable.
The -webkit-transition Boolean non-standardCSS media feature is a WebKit extension whose value is true if the browsing context supports CSS transitions. Apple has a description in Safari CSS Reference; this is now called transition there.
To create an animation using WebKit, use the -webkit-animation in conjunction with the @-webkit-keyframes keyword/at-rule, which allows you to define visual effects for your animation. The CSS -webkit-animation property is a proprietary CSS extension that is supported by the WebKit browser engine.
It's not widely supported. See a complete list of CSS properties that support transition here. I would have a different approach. Wrap your element with background-color
you wanted to do transition to, and do a scale transition for your element.
<div class="your-wrapper"> <div class="your-div"> </div> </div>
also make sure to add proper styling
.your-wrapper { overflow:hidden } .your-div { transition: transform 0.5s; -webkit-transition: -webkit-transform 0.5s } .your-wrapper:hover .your-div{ transform: scale(1.5); -webkit-transform: scale(1.5); }
This should do.
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;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With