HTML5悬停其他图片模糊特效

<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>图片悬停模糊特效</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f5f5f5;
            padding: 20px;
            text-align: center;
        }

        h1 {
            color: #333;
            margin-bottom: 30px;
        }

        .image-container {
            display: flex;
            justify-content: center;
            flex-wrap: wrap;
            gap: 20px;
            margin-top: 30px;
        }

        .image-wrapper {
            position: relative;
            width: 200px;
            height: 200px;
            overflow: hidden;
            border-radius: 10px;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
            transition: filter 0.3s ease;
        }

        .image-wrapper img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            transition: transform 0.3s ease;
        }

        .image-wrapper:hover img {
            transform: scale(1.05);
        }

        /* 当悬停一个图片时,其他图片模糊 */
        .image-container:hover .image-wrapper:not(:hover) {
            filter: blur(3px);
        }

        .info {
            margin: 40px auto;
            padding: 20px;
            background-color: white;
            border-radius: 8px;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
            max-width: 600px;
        }

        .info a {
            color: #0066cc;
            text-decoration: none;
        }

        .info a:hover {
            text-decoration: underline;
        }
    </style>
</head>
<body>
    <h1>图片悬停模糊特效</h1>

    <div class="info">
        <p>这是一个HTML5悬停模糊特效演示。当你将鼠标悬停在任意一张图片上时,其他图片会变得模糊。</p>

    </div>

    <div class="image-container">
        <div class="image-wrapper">
            <img src="https://picsum.photos/id/10/800/800" alt="风景1">
        </div>
        <div class="image-wrapper">
            <img src="https://picsum.photos/id/11/800/800" alt="风景2">
        </div>
        <div class="image-wrapper">
            <img src="https://picsum.photos/id/12/800/800" alt="风景3">
        </div>
        <div class="image-wrapper">
            <img src="https://picsum.photos/id/13/800/800" alt="风景4">
        </div>
        <div class="image-wrapper">
            <img src="https://picsum.photos/id/14/800/800" alt="风景5">
        </div>
        <div class="image-wrapper">
            <img src="https://picsum.photos/id/15/800/800" alt="风景6">
        </div>
    </div>

    <script>
        // 这里可以添加JavaScript代码(如果需要)
        document.addEventListener('DOMContentLoaded', function() {
            console.log('页面加载完成');
        });
    </script>
</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值