Using a transition when enlarging an image doesn't seem to work in chrome.
HTML:
<img src="foobar.png">
CSS:
img
{
float: left;
margin-right: 10px;
border-radius: 10px;
width: 200px;
-webkit-transition: width 1s ease, height 1s ease;
}
img:hover
{
width: 100%;
}
Fiddle: http://jsfiddle.net/6Dk4D/
What is wrong?
It won't work with percentages it seems. Also, if you wish to transition height
as well, you need to declare it in the orignal img
styling. Shown here: http://jsfiddle.net/Skooljester/6Dk4D/1/ it works if you specify a width
in pixels for the hover.
Edit: If you specify the first width
as a percentage then the second can be defined with a percent as well and still work. Thank you Tyilo
You can also use a max-width
trick. Set a high max-width
amount on the hover and the original image width will be respected by the transition.
http://codepen.io/rustydev/pen/BKOBNZ
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