CSS transform scale to background image

孤街醉人 提交于 2019-12-08 02:09:29

问题


I have beloved CSS part effecting for a image

.split-banner .right-cl:hover img {
    -webkit-transform: scale(1.1);
    transform: scale(1.1);
}

I need to apply above CSS to background image contain in a div element How can I do that?


回答1:


Change background-size on hover. To mimic scale(1.1) use 110%.

div {
  width: 560px;
  height: 400px;
  background: url('http://kenwheeler.github.io/slick/img/fonz1.png') center center no-repeat;
}
div:hover {
  background-size: 110%;
}
<div></div>


来源:https://stackoverflow.com/questions/42616579/css-transform-scale-to-background-image

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!