悬停时缩放背景图像
Zoom background image on hover
我有一个div的背景图像,我想在悬停时放大它,这是我使用的代码
<div class="col-md-6 col-sm-6 col-xs-12 blocks" id="outfit">
<h3>Cafes and restautrents </h3>
<p>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has be
</p>
<a class="btn btn-default">View More</a>
</div>
CSS
#outfit{
background:url(../images/outfit-bg.png) right bottom no-repeat #DFD2C1;
color:#86A3B1;
transition: all 1s ease;
-moz-transition: all 1s ease;
-ms-transition: all 1s ease;
-webkit-transition: all 1s ease;
-o-transition: all 1s ease;
}
#outfit:hover {
transform: scale(1.5);
-moz-transform: scale(1.5);
-webkit-transform: scale(1.5);
-o-transform: scale(1.5);
-ms-transform: scale(1.5); /* IE 9 */
-ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=1.5, M12=0, M21=0, M22=1.5, SizingMethod='auto expand')"; /* IE8 */
filter: progid:DXImageTransform.Microsoft.Matrix(M11=1.5, M12=0, M21=0, M22=1.5, SizingMethod='auto expand'); /* IE6 and 7 */
}
这是放大整个div,我如何只针对该div中的背景图像来实现放大效果
开始:
#outfit{
background:url(http://www.intrawallpaper.com/static/images/1968081.jpg) no-repeat ;
color:#86A3B1;
background-size: 100%;
transition: all 1s ease;
-moz-transition: all 1s ease;
-ms-transition: all 1s ease;
-webkit-transition: all 1s ease;
-o-transition: all 1s ease;
}
#outfit:hover {
background-size: 150%;
}
jsFiddle
您可以使用background-size
来执行此操作,只需确保在div 上设置background-size:100%
#outfit{
background:url("https://placeimg.com/500/300/animals") right bottom no-repeat #DFD2C1;
color:#86A3B1;
transition: all 1s ease;
-moz-transition: all 1s ease;
-ms-transition: all 1s ease;
-webkit-transition: all 1s ease;
-o-transition: all 1s ease;
background-size:100%;
}
#outfit:hover {
background-size:150%;
}
<div class="col-md-6 col-sm-6 col-xs-12 blocks" id="outfit">
<h3>Cafes and restautrents </h3>
<p>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has be
</p>
<a class="btn btn-default">View More</a>
</div>
相关文章:
- 在视频和图像背景之间切换
- 带有图像背景的简单倒数计时器
- 无法设置图像背景图像
- 使用jQuery的透明图像背景
- 加快图像背景的页面加载速度
- HTML5 画布 - 如何在图像背景上画一条线
- IE8(Javascript和CSS)中带有拉伸BG的渐变图像背景
- 需要有关所选图像背景颜色的帮助.并将背景去除到所选择的其他图像
- 透明图像背景html5画布
- 你能帮我最大化我的图像背景吗
- 实现基于浏览器宽度的大图像背景拉伸的最简单方法
- Javascript改变图像/背景图像不工作
- 使悬停时的图像背景变暗,不影响文字
- 如何在javascript中扩展画布图像's背景并转换为文件对象
- JQuery移动设置图像背景与CSS
- 向图像(背景图像)添加超链接
- 课程互动360视频/图像背景在html5引导
- 在jQM中,为页面设置全屏CSS图像背景的正确/正确/实际方法是什么?
- 链接上随机图像背景
- 在JavaScript上设置图像背景形状