学新通技术网

css 图片鼠标滑动放大

Luke 1696 1
css 图片鼠标滑动放大

css 图片鼠标滑动放大

/* 主要内容 */
transition: all 1s; 
background-size: cover;
transform: scale(1.1);

下面是示例

<!DOCTYPE html>
<html>
<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>学新通示例</title>
    <style>
        *, body, html {
            margin: 0; padding: 0;
        }
        img {
            width: 300px;
            overflow: hidden;
            margin: 0 auto;
        }
        img:hover {
            transition:all 2s;/*图片放大过程的时间*/
            cursor: crosshair;
            transform: scale(1.9);  /*以y轴为中心旋转*/
        }
    </style>
</head>
<body>
    <div id="img">
        <img src="https://www.swvq.com/Uploads/image/WebWechat/202011/28/1606545110.jpg" alt="">
    </div>
</body>
</html>

 

本文出至:学新通技术网

标签: