[CSS] Scale on Hover with Transition
2017-04-17 15:15
363 查看
效果
源码
img-box: 装图片的盒子,确保子元素超出部分隐藏起来.
image-scale: 绝对定位,并手动设置图片居中.
素材
源码
<!doctype html> <html class="outline color"> <head> <meta charset="utf-8"> <title>图片scale动画</title> <style> .img-box { position: relative; width: 740px; height: 420px; overflow: hidden; } /* 彩色图片缩放动画 */ .img-box>.image-scale { position: absolute; width: 900px; height: 580px; top: -80px; left: -80px; background-size: cover; transition: all 0.5s ease-in-out; } .img-box:hover>.image-scale { transform: scale(0.822); } </style> </head> <body> <div class="img-box"> <div class="image-scale" style="background-image: url(./images/1.jpg);"></div> </div> </body> </html>
img-box: 装图片的盒子,确保子元素超出部分隐藏起来.
image-scale: 绝对定位,并手动设置图片居中.
素材
相关文章推荐
- 16. 3. 12. 鼠标拖拽及滑轮图形Move and scale graphical objects with a mouse on the panel
- Preload Css hover Images with Javascript
- CSS中2d转换:transition过渡放在:hover伪类中与应用在整个元素中区别
- Notes on Large-scale Video Classification with Convolutional Neural Networks
- Choose a destination with a supported architecture in order to run on this device
- CSS :hover 伪类
- Training MNIST LeNet on MNIST with Caffe
- Destroy method on bean with name 'sqlSessionFactory' threw an exception
- VPS: Nginx, PHP5 & ASP.NET with FastCGI on ubuntu-server 10.04 LTS
- Build a basic responsive site with CSS
- Unique constraint on single String column with GreenDao
- Using Eclipse with PyDev to build a Python development environment on Windows platform
- msrcr(Multi-Scale Retinex with Color Restoration) 带色彩恢复的多尺度视网膜增强算法 整理
- 安装SP2后,提示"'Preserving/Deleting template record with size","The expected version of the product was not found on the “错误
- What's going on with Eric?
- css中遇到的技巧和坑儿——background-size使用transition失效
- Working with BeforeProperties and AfterProperties on SPItemEventReceiver
- When cloning on with git bash on Windows, getting Fatal: UriFormatException encountered
- 通过CSS效果:隔行变色和鼠标掠过高亮,学习JQuey的css()、hover()方法
- 你真的了解html代码的事件,离开焦点和聚焦焦点的动作的意思吗?onblur、focus?它们是点击才可以触发,而不是鼠标悬停,鼠标悬停是hover