css实现图片放大效果

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            width: 400px;
            height: 300px;
            overflow: hidden;
            border-radius: 15px;
        }

        .box img {
            cursor: pointer;
            /* 谁做过渡给谁加,transition: 要过渡的属性 花费时间 运动曲线(可省略) 何时开始(可省略) */
            transition: all 1.5s;
            background-size: cover;
        }

        .box img:hover {
            transform: scale(1.1);
        }
    </style>
</head>

<body>
    <div class="box">
        <img src="./744908.jpg" width="100%" height="100%">
    </div>
</body>

</html>

 

posted @ 2021-12-26 23:08  yw3692582  阅读(561)  评论(0编辑  收藏  举报