1. 主题阁汉化首页
  2. 特效代码

CSS3图片遮罩层变形动画特效

CSS3图片遮罩层变形动画特效

使用方法
在 HTML 文件中引入

  1. <link rel=“stylesheet” type=“text/css” href=“css/bootstrap-grid.min.css” />
  2. <link href=“https://cdn.bootcss.com/font-awesome/5.11.2/css/all.min.css” rel=“stylesheet”>

HTML 结构

  1. <div class=“container”>
  2.     <div class=“row”>
  3.         <div class=“col-md-3 col-sm-6”>
  4.             <div class=“product-grid”>
  5.                 <div class=“product-image”>
  6.                     <a href=“#” class=“image”>
  7.                         <img class=“pic-1” src=“images/img-1.jpg”>
  8.                         <img class=“pic-2” src=“images/img-2.jpg”>
  9.                     </a>
  10.                     <div class=“product-button-group”>
  11.                         <a href=“#” class=“add-to-wishlist”>Add to wishlist</a>
  12.                         <a href=“#” class=“quick-view”>Quick view</a>
  13.                     </div>
  14.                 </div>
  15.                 <div class=“product-content”>
  16.                     <h3 class=“title”><a href=“#”>Women’s Blouse Top</a></h3>
  17.                     <div class=“price”>$25.00</div>
  18.                     <a href=“#” class=“add-to-cart”>Add to Cart</a>
  19.                 </div>
  20.             </div>
  21.         </div>
  22.         <div class=“col-md-3 col-sm-6”>
  23.             <div class=“product-grid”>
  24.                 <div class=“product-image”>
  25.                     <a href=“#” class=“image”>
  26.                         <img class=“pic-1” src=“images/img-3.jpg”>
  27.                         <img class=“pic-2” src=“images/img-4.jpg”>
  28.                     </a>
  29.                     <span class=“product-sale-label”>Sale</span>
  30.                     <div class=“product-button-group”>
  31.                         <a href=“#” class=“add-to-wishlist”>Add to wishlist</a>
  32.                         <a href=“#” class=“quick-view”>Quick view</a>
  33.                     </div>
  34.                 </div>
  35.                 <div class=“product-content”>
  36.                     <h3 class=“title”><a href=“#”>Men’s Shirt</a></h3>
  37.                     <div class=“price”><span>$35.00</span> $28.00</div>
  38.                     <a href=“#” class=“add-to-cart”>Add to Cart</a>
  39.                 </div>
  40.             </div>
  41.         </div>
  42.     </div>
  43. </div>

CSS 样式

  1. .product-grid{ font-family: ‘Source Sans Pro’, sans-serif; }
  2. .product-grid .product-image{
  3.     positionrelative;
  4.     overflowhidden;
  5. }
  6. .product-grid .product-image a.image{ displayblock; }
  7. .product-grid .product-image img{
  8.     width: 100%;
  9.     heightauto;
  10. }
  11. .product-image .pic-1{
  12.     backface-visibilityhidden;
  13.     transition: all .5s ease 0s;
  14. }
  15. .product-grid .product-image:hover .pic-1{
  16.     opacity: 0;
  17.     transform: translateX(-50%);
  18. }
  19. .product-image .pic-2{
  20.     width: 100%;
  21.     height: 100%;
  22.     backface-visibilityhidden;
  23.     opacity: 0;
  24.     positionabsolute;
  25.     top: 0;
  26.     left: 50%;
  27.     transition: all .5s ease 0s;
  28. }
  29. .product-grid .product-image:hover .pic-2{
  30.     opacity: 1;
  31.     left: 0;
  32. }
  33. .product-grid .product-sale-label{
  34.     color#fff;
  35.     background#b79b6c;
  36.     font-size13px;
  37.     font-weight: 600;
  38.     text-aligncenter;
  39.     text-transformuppercase;
  40.     padding5px 10px;
  41.     border-radius: 3px 10px 10px 3px;
  42.     positionabsolute;
  43.     top10px;
  44.     left10px;
  45. }
  46. .product-grid .product-button-group{
  47.     font-size: 0;
  48.     width: 100%;
  49.     opacity: 0;
  50.     transform: perspective(600px) translateY(15px) rotateX(90deg);
  51.     transform-origin: bottombottom center;
  52.     positionabsolute;
  53.     bottombottom15px;
  54.     left: 0;
  55.     transition: all 0.3s ease 0.1s;
  56. }
  57. .product-grid:hover .product-button-group{
  58.     opacity: 1;
  59.     transform: translateY(0) rotateX(0);
  60. }
  61. .product-grid .product-button-group a{
  62.     color#fff;
  63.     background#333;
  64.     font-size12px;
  65.     font-weight: 600;
  66.     text-transformcapitalize;
  67.     text-aligncenter;
  68.     width: calc(50% – 4px);
  69.     padding10px 5px;
  70.     margin: 0 2px;
  71.     border-radius: 3px;
  72.     box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  73.     displayinlineblock;
  74.     transition: all 0.3s ease 0s;
  75. }
  76. .product-grid .product-button-group a:hover{ background-color#b79b6c; }
  77. .product-grid .product-content{
  78.     padding12px 0 0;
  79.     positionrelative;
  80. }
  81. .product-grid .title{
  82.     font-size20px;
  83.     font-weight: 500;
  84.     text-transformcapitalize;
  85.     margin: 0 0 5px;
  86. }
  87. .product-grid .title a{
  88.     color#333;
  89.     transition: all 0.5s ease;
  90. }
  91. .product-grid .title a:hover{ color#b79b6c; }
  92. .product-grid .price{
  93.     color#b79b6c;
  94.     font-size18px;
  95.     font-weight: 600;
  96. }
  97. .product-grid .price span{
  98.     color#999;
  99.     font-size17px;
  100.     font-weight: 500;
  101.     text-decorationline-through;
  102.     margin-right2px;
  103. }
  104. .product-grid:hover .price{ opacity: 0; }
  105. .product-grid .add-to-cart{
  106.     color#333;
  107.     font-size16px;
  108.     font-weight: 600;
  109.     opacity: 0;
  110.     positionabsolute;
  111.     bottombottom: –5px;
  112.     left: 0;
  113.     transition: all 0.3s linear 0s;
  114. }
  115. .product-grid .add-to-cart:hover{
  116.     color#b79b6c;
  117.     text-decorationunderline;
  118. }
  119. .product-grid:hover .add-to-cart{
  120.     opacity: 1;
  121.     bottombottom2px;
  122. }
  123. @media screen and (max-width:990px){
  124.     .product-grid{ margin: 0 0 30px; }
  125. }

 

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布,如若转载,请注明出处:https://themege.net/1334.html。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。

发表评论

登录后才能评论
联系我们

联系我们

在线咨询:点击这里给我发消息

邮件:themege@163.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信
关注微信
分享本页
返回顶部