• css3实现鼠标移入图片特效


    1.展示效果

    废话不说直接上源码

    <!DOCTYPE html>
    <html lang="en">
    <head>
       <meta charset="UTF-8">
       <title>test</title>
       <style>
           .container{
               1200px;
               height:auto;
           }
           .container .img-box{
               overflow:hidden;
               position: relative;
               240px;
               height:135px;
               display: inline-block;
               cursor:pointer;
    
           }
           .container img{
               position: absolute;
               top:0;
               left:0;
               100%;
               height:100%;
               transition:all .5s;
           }        
           .container .overlay{
               position: absolute;
               100%;
               height:100%;
               top:0;
               left:0;
               z-index:2;
               line-height:135px;
               text-align: center;
               background-color: rgba(0,0,0,.5);
               opacity: 0;
           }
           .container .title{
               color:#fff;
           }
           .img-box:hover img{
               transform:scale(1.2);
           }
           .img-box:hover .overlay{
               opacity: 1;
           }
       </style>
    </head>
    <body>
       <div class="container">
           <div class="img-box">            
               <img src="https://i.loli.net/2020/04/18/ZODRtue8bsVMBco.jpg">
               <div class="overlay">
                   <div class="title">图片标题1</div>
               </div>
           </div>
           <div class="img-box">            
               <img src="https://i.loli.net/2020/04/18/z7NXetAJvcpxCmH.jpg">
               <div class="overlay">
                   <div class="title">图片标题2</div>
               </div>
           </div>
       </div>
    </body>
    </html>
    
  • 相关阅读:
    AT2165 Median Pyramid Hard
    AT2160 へんなコンパス / Manhattan Compass
    bzoj2863:愤怒的元首
    bzoj5336:[TJOI2018]party
    [luoguP3768]简单的数学题
    bzoj1831:[AHOI2008]逆序对
    bzoj5492:[Hnoi2019]校园旅行
    HNOI2019游记
    HDU 1102 Constructing Roads(kruskal)
    HDU 1059 Dividing
  • 原文地址:https://www.cnblogs.com/yaoliuyang/p/12728090.html
Copyright © 2020-2023  润新知