图片/图形

纯CSS3鼠标悬停图片3D动画特效

阿里云


这是一款纯 CSS3 鼠标悬停图片 3D 动画特效。该特效在鼠标悬停到图片上面的时候,图片通过 CSS 实现 3D 倾斜动画,并显示出遮罩层,非常炫酷。

使用方法

在页面中引入下面的文件。

也想出现在这里?联系我们
创客主机
  1. <link rel="stylesheet" type="text/css" href="./css/bootstrap.min.css">
  2. <link rel="stylesheet" type="text/css" href="./css/font-awesome.min.css">

HTML 结构

  1. <div class="container">
  2.     <div class="row">
  3.         <div class="col-md-4 col-sm-6">
  4.             <div class="box">
  5.                 <img src="images/img-1.jpg">
  6.                 <div class="box-content">
  7.                     <h3 class="title">Williamson</h3>
  8.                     <span class="post">Web designer</span>
  9.                 </div>
  10.                 <ul class="icon">
  11.                     <li><a href="#"><i class="fa fa-search"></i></a></li>
  12.                     <li><a href="#"><i class="fa fa-link"></i></a></li>
  13.                 </ul>
  14.             </div>
  15.         </div>
  16.         <div class="col-md-4 col-sm-6">
  17.             <div class="box">
  18.                <img src="images/img-2.jpg">
  19.                 <div class="box-content">
  20.                     <h3 class="title">Miranda Roy</h3>
  21.                     <span class="post">Web designer</span>
  22.                 </div>
  23.                 <ul class="icon">
  24.                     <li><a href="#"><i class="fa fa-search"></i></a></li>
  25.                     <li><a href="#"><i class="fa fa-link"></i></a></li>
  26.                 </ul>
  27.             </div>
  28.         </div>
  29.     </div>
  30. </div>

CSS 样式

  1. .box{
  2.     font-family: 'Merriweather Sans', sans-serif;
  3.     text-align: center;
  4.     transform: perspective(900px);
  5.     transform-style: preserve-3d;
  6.     overflow: hidden;
  7.     position: relative;
  8.     transition: all .5s;
  9. }
  10. .box:hover{
  11.     box-shadow: 3px 3px 5px #999;
  12.     transform: perspective(900px) rotateX(20deg) rotateY(0deg);
  13. }
  14. .box:before{
  15.     content: '';
  16.     background: #f20909;
  17.     width: 100%;
  18.     height: 100%;
  19.     transform: scale3d(0, 1, 0);
  20.     transform-origin: center;
  21.     position: absolute;
  22.     top: 0;
  23.     left: 0;
  24.     z-index: 1;
  25.     transition: all .5s ease .1s;
  26. }
  27. .box:hover:before{
  28.     opacity: 0.6;
  29.     transform: scale3d(1, 1, 1);
  30. }
  31. .box img{
  32.     width: 100%;
  33.     height: 100%;
  34.     transition: all 0.5s;
  35. }
  36. .box:hover img{ transform: rotate(10deg) scale(1.3); }
  37. .box .box-content{
  38.     width: 100%;
  39.     opacity: 0;
  40.     transform: translateX(-50%) translateY(-50%)  scale(0);
  41.     position: absolute;
  42.     top: 50%;
  43.     left: 50%;
  44.     z-index: 1;
  45.     transition: all 0.4s linear 0s;
  46. }
  47. .box:hover .box-content{
  48.     opacity: 1;
  49.     transform: translateX(-50%) translateY(-50%)  scale(1);
  50. }
  51. .box .title{
  52.     color: #fff;
  53.     font-size: 25px;
  54.     font-weight: 700;
  55.     text-transform: uppercase;
  56.     text-shadow: 0 2px 5px #000;
  57.     margin: 0 0 3px 0;
  58. }
  59. .box .post{
  60.     color: #fff;
  61.     font-size: 15px;
  62.     letter-spacing: 2px;
  63.     text-shadow: 2px 0 5px #000;
  64.     text-transform: uppercase;
  65. }
  66. .box .icon{
  67.     padding: 0;
  68.     margin: 0;
  69.     list-style: none;
  70.     position: absolute;
  71.     bottom: 10px;
  72.     left: 10px;
  73.     z-index: 1;
  74. }
  75. .box .icon li{
  76.     display: inline-block;
  77.     opacity: 0;
  78.     transition: all 0.3s;
  79. }
  80. .box:hover .icon li:nth-child(1){ transition-delay: 0.3s; }
  81. .box:hover .icon li:nth-child(2){ transition-delay: 0.45s; }
  82. .box:hover .icon li{ opacity: 1; }
  83. .box .icon li a{
  84.     color: #f20909;
  85.     background-color: #fff;
  86.     font-size: 20px;
  87.     line-height: 35px;
  88.     height: 35px;
  89.     width: 35px;
  90.     margin: 0 7px 0 0;
  91.     box-shadow: 3px 3px 5px #000;
  92.     display: block;
  93.     transition: all 0.3s;
  94. }
  95. .box .icon li  a:hover{
  96.     color: #fff;
  97.     background-color: transparent;
  98. }
  99. @media only screen and (max-width:990px){
  100.     .box { margin: 0 0 30px; }
  101. }
  102. @media only screen and (max-width:767px){
  103.     .box{ margin: 0 20px 30px; }
  104. }
  105. @media only screen and (max-width:576px){
  106.     .box{ margin: 0 5px 30px; }
  107. }
  108. @media only screen and (max-width:479px){
  109.     .box{ margin: 0 0 30px; }
  110.     .box .title{ font-size: 21px; }
  111.     .box .post{ font-size: 14px; }
  112. }

纯 CSS3 鼠标悬停图片 3D 动画特效

已有 396 人购买
  • 1ypp
查看演示升级 VIP立刻购买

演示地址 下载地址
收藏
(0)

发表回复

热销模板

Ashade - 作品展示摄影相册WordPress汉化主题
LensNews

本站承接 WordPress / PbootCMS / DedeCMS 等
系统建站、仿站、开发、定制等业务!