图片/图形

旋转放大CSS3鼠标悬停图片动画特效

阿里云


这是一款带旋转放大的 CSS3 鼠标悬停图片动画特效。该特效在鼠标悬停到图片上面的时候,图片会旋转放大,同时在图片上出现遮罩层和描述文字。

使用方法

在页面中引入 fontawsome 和 bootstrap 文件。

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

HTML 结构

图片的基本 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" alt="">
  6.                 <div class="box-content">
  7.                     <h3 class="title">Steve Thomas</h3>
  8.                     <span class="post">Web developer</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" alt="">
  19.                 <div class="box-content">
  20.                     <h3 class="title">Kristina</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 class="col-md-4 col-sm-6">
  30.             <div class="box">
  31.                 <img src="images/img-3.jpg" alt="">
  32.                 <div class="box-content">
  33.                     <h3 class="title">Miranda Roy</h3>
  34.                     <span class="post">Web developer</span>
  35.                 </div>
  36.                 <ul class="icon">
  37.                     <li><a href="#"><i class="fa fa-search"></i></a></li>
  38.                     <li><a href="#"><i class="fa fa-link"></i></a></li>
  39.                 </ul>
  40.             </div>
  41.         </div>
  42.     </div>
  43. </div>

CSS 样式

然后通过下面的 CSS 样式来制作鼠标悬停动画特效。

  1. .box{
  2.     font-family: 'Ubuntu', sans-serif;
  3.     position: relative;
  4.     overflow: hidden;
  5. }
  6. .box:before{
  7.     content: '';
  8.     background: linear-gradient(45deg,rgba(103,178,111,0.6), rgba(76,162,205,0.6));
  9.     height: 100%;
  10.     width: 100%;
  11.     opacity: 0;
  12.     filter: blur(10px);
  13.     transform: scale(1) rotate(180deg);
  14.     position: absolute;
  15.     left: 0;
  16.     top: 0;
  17.     z-index: 1;
  18.     transition: all 0.4s ease-in-out;
  19. }
  20. .box:hover:before{
  21.     box-shadow: 0 0 10px 2px #555;
  22.     opacity: 1;
  23.     filter: blur(0);
  24.     transform: scale(0.92, 0.9) rotate(0);
  25. }
  26. .box img{
  27.     width: 100%;
  28.     height: auto;
  29.     transition: all 0.5s ease-in-out;
  30. }
  31. .box:hover img{ transform: scale(1.9) rotate(45deg); }
  32. .box .box-content{
  33.     color: #fff;
  34.     text-align: center;
  35.     width: 100%;
  36.     opacity: 0;
  37.     transform: translateX(-50%) translateY(-50%) scale(3);
  38.     position: absolute;
  39.     top: 50%;
  40.     left: 50%;
  41.     z-index: 1;
  42.     transition: all 0.5s ease;
  43. }
  44. .box:hover .box-content{
  45.     opacity: 1;
  46.     transform: translateX(-50%) translateY(-50%) scale(1);
  47. }
  48. .box .title{
  49.     font-size: 25px;
  50.     font-weight: 700;
  51.     letter-spacing: 1px;
  52.     text-transform: uppercase;
  53.     margin: 0;
  54. }
  55. .box .post{
  56.     font-size: 16px;
  57.     text-transform: capitalize;
  58. }
  59. .box .icon{
  60.     padding: 0;
  61.     margin: 0;
  62.     list-style: none;
  63.     filter: blur(10px);
  64.     transform: scale(0);
  65.     position: absolute;
  66.     right: 20px;
  67.     bottom: 20px;
  68.     z-index: 2;
  69.     transition: all 0.5s ease 0.2s;
  70. }
  71. .box:hover .icon{
  72.     transform: scale(1);
  73.     filter: blur(0);
  74. }
  75. .box .icon li{ display: inline-block; }
  76. .box .icon li a{
  77.     color: #fff;
  78.     background: rgba(255,255,255,0.2);
  79.     font-size: 20px;
  80.     text-align: center;
  81.     line-height: 40px;
  82.     height: 40px;
  83.     width: 40px;
  84.     margin: 0 3px;
  85.     display: block;
  86.     position: relative;
  87.     transition: all 0.3s;
  88. }
  89. .box .icon li a:hover{
  90.     text-shadow: 0 0 6px #555;
  91.     box-shadow: 0 0 5px #555;
  92. }
  93. @media only screen and (max-width:990px){
  94.     .box{ margin-bottom: 30px; }
  95. }
  96. @media only screen and (max-width:479px){
  97.     .box .title{ font-size: 20px; }
  98. }

旋转放大 CSS3 鼠标悬停图片动画特效

已有 337 人购买
查看演示升级 VIP立刻购买

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

发表回复

热销模板

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

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