zoukankan      html  css  js  c++  java
  • 缩放实例

    代码:

    <!DOCTYPE html>
    <html lang="en">
    
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>缩放实例</title>
        <style>
            * {
                padding: 0;
                margin: 0;
            }
    
            .c {
                width: 1140px;
                margin: 50px auto 0;
                height: 385px;
            }
    
            .left {
                position: relative;
                overflow: hidden;
                float: left;
                width: 680px;
                height: 100%;          
            }
    
            .right {
                width: 450px;
                float: right;
                height: 100%;          
            }
    
            .right .top {
                overflow: hidden;
                position: relative;
                height: 188px;
                margin-bottom: 10px;
            }
    
            .right .bottom {
                overflow: hidden;
                position: relative;
                height: 188px;
            }
            .c img {
                width: 100%;
                height: 100%;
                transition: transform 0.35s linear 0s;
            }
    
            .borderWhite::after {
                content: '';
                /* 公共样式  四条边界距离10px */
                position: absolute;
                left: 10px;
                top: 10px;
                bottom: 10px;
                right: 10px;
                border:2px solid #fff;
                transform:scale(1.1);
                display: none;
            }
            /* 找伪元素 */
            .left:hover:after {
                transform:scale(1);
                /* 鼠标移出没有过度 */
                transition: transform 0.35s linear 0s;
                display: block;
            }
            
            .left:hover img {
                transform:scale(1.2);
            }
    
            .top:hover:after {
                transform:scale(1);
                transition: transform 0.35s linear 0s;
                display: block;
            }
            
            .top:hover img {
                transform:scale(1.2);
            }
    
            .bottom:hover:after {
                transform:scale(1);
                transition: transform 0.35s linear 0s;
                display: block;
            }
            
            .bottom:hover img {
                transform:scale(1.2);
            }
        </style>
    </head>
    
    <body>
        <div class="c">
            <div class="left borderWhite">
                <a href="">
                    <img src="img/qz.jpg" alt="">
                </a>
            </div>
            <div class="right">
                <div class="top borderWhite">
                    <a href="">
                        <img src="img/qz_1.jpg" alt="">
                    </a>
                </div>
                <div class="bottom borderWhite">
                    <a href="">
                        <img src="img/qz_2.jpg" alt="">
                    </a>
                </div>
            </div>
        </div>
    </body>
    
    </html>

    效果:

    由初始样式(下图):

    鼠标划入:白色边框缩放显示,图片放大显示,溢出隐藏,如下图:

  • 相关阅读:
    python操作mysql数据库
    Turtle绘制带颜色和字体的图形(Python3)
    Windows单机最大TCP连接数的问题
    This network connection does not exist
    python3 条件判断,循环,三元表达式
    基于SolidWorks设计算例的柴油机飞轮平衡孔的研究
    VOC2007数据集转换成CSV格式[
    xml -> csv
    目标检测 – 解析VOC和COCO格式并制作自己的数据集
    什么是电磁阀,电磁阀常见故障与解决方法
  • 原文地址:https://www.cnblogs.com/shihaiying/p/13564643.html
Copyright © 2011-2022 走看看