用3Dcss3 & Htm and js 制作悬停图片翻转特效【网页设计】cid1154


Warning: Undefined property: stdClass::$maxbutton id="5" in /www/wwwroot/code.5g-o.com/wp-content/plugins/kama-clic-counter/class.KCCounter.php on line 733

html and css

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>hover effect</title>
      <link href="https://fonts.googleapis.com/css?family=Roboto+Condensed:300,300i,400,400i,700i" rel="stylesheet">
    
    <style>
    body{    
         background-color: #3f1e4d;
        height: 100vh;
        background-position: center;
        background-size: cover;
    font-family: 'Roboto Condensed', sans-serif;
        overflow: hidden;
    
}
    *{
  margin: 0;
  padding: 0;
  -webkit-box-sizing: border-box;
          box-sizing: border-box;
}
 
.wrapper{
  width: 90%;
  margin: 0 auto;
  max-width: 80rem;
    margin-top: 84px;
}

.cols{
  display: -webkit-box;   
  display: flex;
  flex-wrap: wrap;
  -webkit-box-pack: center;
  justify-content: center;
    
}

.col{
  width: calc(25% - 2rem);
  margin: 1rem;
  cursor: pointer;
    margin-left: -5px;
    margin-bottom: -5px;
}

.container{
        transform-style: preserve-3d;
      perspective: 1000px;
}

.front,
.back{
  background-size: cover;
  background-position: center; 
  transition: transform .7s cubic-bezier(0.4, 0.2, 0.2, 1);
     backface-visibility: hidden;
  text-align: center;
  min-height: 280px;
  height: auto; 
  color: #fff;
  font-size: 1rem;
    border: 4px solid white;
    border-radius: 150px;
}

.back{
  background: #fff;  
  background: linear-gradient(45deg,  #3f1e4d 0%,#fff 100%);
}

.front:after{
  position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    content: '';
    display: block;
        
    backface-visibility: hidden;
     
}
.container:hover .front,
.container:hover .back{
     
    transition: transform .7s cubic-bezier(0.4, 0.2, 0.2, 1);
     
}

.back{
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
}

.inner{
  
    transform: translateY(-50%) translateZ(60px) scale(0.94);
    top: 50%;
    position: absolute;
    left: 0;
    width: 100%;
    padding: 2rem;     
    box-sizing: border-box;
    outline: 1px solid transparent;     
    perspective: inherit;
    z-index: 2;
}

.container .back{    
    transform: rotateY(180deg);     
    transform-style: preserve-3d;
}

.container .front{
    transform: rotateY(0deg);
    transform-style: preserve-3d;
}

.container:hover .back{
   transform: rotateY(0deg);
   transform-style: preserve-3d;
}

.container:hover .front{
      transform: rotateY(-180deg);
      transform-style: preserve-3d;
}

.front .inner p{
  font-size: 1rem;
  margin-bottom: 2rem;
  position: relative;
}

.front .inner p:after{
  content: '';
  width: 4rem;
  height: 2px;
  position: absolute;
  background: #fff;
  display: block;
  left: 0;
  right: 0;
  margin: 0 auto;
  bottom: -.75rem;
}

.front .inner span{
  color: fff;   
  font-family: 'Roboto Condensed', sans-serif;   
  font-weight: 300;
}

@media screen and (max-width: 64rem){
  .col{
    width: calc(33.333333% - 2rem);
  }
}

@media screen and (max-width: 48rem){
  .col{
    width: calc(50% - 2rem);
  }
}

@media screen and (max-width: 32rem){
  .col{
    width: 100%;
    margin: 0 0 2rem 0;
  }
}
    </style>
</head>
<body>
    
    <div class="wrapper">   
  <div class="cols">
      <div class="col">
        <div class="container">
          <div class="front" style="background-image: url(1.jpg)">
             
          </div>
          <div class="back">
            <div class="inner">
              <p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Alias cum repellat velit quae suscipit c.</p>
            </div>
          </div>
        </div>
      </div>
      <div class="col">
        <div class="container">
          <div class="front" style="background-image: url(2.jpg);">
           </div>
          <div class="back">
            <div class="inner">
              <p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Alias cum repellat velit quae suscipit c.</p>
            </div>
          </div>
        </div>
      </div>
      <div class="col">
        <div class="container">
          <div class="front" style="background-image: url(5.jpg);">
             
          </div>
          <div class="back">
            <div class="inner">
              <p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Alias cum repellat velit quae suscipit c.</p>
            </div>
          </div>
        </div>
      </div>
      <div class="col">
        <div class="container">
          <div class="front" style="background-image: url(4.jpg)">
             
          </div>
          <div class="back">
            <div class="inner">
              <p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Alias cum repellat velit quae suscipit c.</p>
            </div>
          </div>
        </div>
      </div>
      <div class="col">
        <div class="container">
          <div class="front" style="background-image: url(3.jpg)">
             
          </div>
          <div class="back">
            <div class="inner">
              <p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Alias cum repellat velit quae suscipit c.</p>
            </div>
          </div>
        </div>
      </div>
      <div class="col">
        <div class="container">
          <div class="front" style="background-image: url(004.jpg)">
              
          </div>
          <div class="back">
            <div class="inner">
              <p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Alias cum repellat velit quae suscipit c.</p>
            </div>
          </div>
        </div>
      </div>
      <div class="col">
        <div class="container">
          <div class="front" style="background-image: url(a5.jpg)">
           
          </div>
          <div class="back">
            <div class="inner">
              <p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Alias cum repellat velit quae suscipit c.</p>
            </div>
          </div>
        </div>
      </div>
      <div class="col">
        <div class="container">
          <div class="front" style="background-image: url(6.jpg)">
             
          </div>
          <div class="back">
            <div class="inner">
              <p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Alias cum repellat velit quae suscipit c.</p>
            </div>
          </div>
        </div>
      </div>
    </div>
 </div>
</body>
</html>

 在线演示


让链接同时具备两种打开方式
获取源码: 35D
下载数:128人次, 文件大小: 733.4 KB, 上传日期: 2021年-5月-14日

公众号回复:gcode  获取解压密码

qrcode_for_gh_6ea2c28a1709_258 (1)

2,769 人查阅

一键获取本网站前端代码设计的所有源码

获取资源构建和完善自己的源码库
源码可以在本地直接演示
同时研究和体验 如何将一些具体的想法的实现过程
源码可以直接嫁接到自己的网站里复用
稍作修改成为自己的作品
下载 (4)

您需要先支付 6元 才能查看此处内容!立即支付

类似文章