我正在尝试将鼠标悬停在我的背景图片上。到目前为止,这是我的代码:
的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%;
}
但这对我不起作用,在不同的浏览器中进行了测试。其他过渡(如背景色)按预期工作。此属性的转换是否有任何限制?
我认为问题出在background-size: cover
,将其更改为
background-size: 100%;
它会工作
还有其他关于background-size: cover
替代方法的问题,可以帮助背景是否有替代background-size:cover的方法?
或类似的解决方案,例如:使用封面时的CSS3 crossfade bg图片
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句