背景尺寸的过渡不起作用

声波750

我正在尝试将鼠标悬停在我的背景图片上。到目前为止,这是我的代码:

的HTML

<div class="item-one"></div>

的CSS

.item-one { 
    height: 345px;
    width: 256px;    
    background: url('http://placehold.it/256x345') scroll no-repeat center center;
    background-size: cover;
    -webkit-transition: background-size 1500ms linear;
    -moz-transition: background-size 1500 linear;
    -o-transition: background-size 1500 linear
    -ms-transition: background-size 1500ms linear;
    transition: background-size 1500ms linear;
}

.item-one:hover {
    background-size: 150%;  
}

参见JSFIDDLE

但这对我不起作用,在不同的浏览器中进行了测试。其他过渡(如背景色)按预期工作。此属性的转换是否有任何限制?

区域

我认为问题出在background-size: cover,将其更改为

background-size: 100%;

它会工作

JSFiddle

还有其他关于background-size: cover替代方法的问题,可以帮助背景是否有替代background-size:cover的方法?

或类似的解决方案,例如:使用封面时的CSS3 crossfade bg图片

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章