CSS列表项悬停特效

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>CSS列表项悬停特效</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Arial', sans-serif;
        }
        
        body {
            background-color: #f5f5f5;
            padding: 50px;
        }
        
        .container {
            max-width: 800px;
            margin: 0 auto;
        }
        
        h1 {
            text-align: center;
            margin-bottom: 30px;
            color: #333;
        }
        
        .special-list {
            list-style: none;
        }
        
        .special-list li {
            background: white;
            margin-bottom: 10px;
            padding: 20px;
            border-radius: 5px;
            box-shadow: 0 2px 5px rgba(0,0,0,0.1);
            transition: all 0.3s ease;
            position: relative;
            overflow: hidden;
        }
        
        .special-list li::before {
            content: '';
            position: absolute;
            top: 0;
            left: -100%;
            width: 100%;
            height: 100%;
            background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
            transition: all 0.5s ease;
        }
        
        .special-list li:hover {
            transform: translateX(10px);
            box-shadow: 0 5px 15px rgba(0,0,0,0.2);
        }
        
        .special-list li:hover::before {
            left: 100%;
        }
        
        .special-list li:nth-child(1):hover {
            background: #ffebee;
            border-left: 5px solid #f44336;
        }
        
        .special-list li:nth-child(2):hover {
            background: #e8f5e9;
            border-left: 5px solid #4caf50;
        }
        
        .special-list li:nth-child(3):hover {
            background: #e3f2fd;
            border-left: 5px solid #2196f3;
        }
        
        .special-list li:nth-child(4):hover {
            background: #fff3e0;
            border-left: 5px solid #ff9800;
        }
        
        .special-list li a {
            text-decoration: none;
            color: #333;
            font-size: 18px;
            display: block;
        }
        
        .special-list li p {
            color: #666;
            margin-top: 10px;
            font-size: 14px;
        }
        
        .footer {
            text-align: center;
            margin-top: 50px;
            color: #999;
            font-size: 14px;
        }
        
        .footer a {
            color: #2196f3;
            text-decoration: none;
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>CSS列表项悬停特效</h1>
        
        <ul class="special-list">
            <li>
                <a href="#">列表项1</a>
                <p>鼠标悬停查看特效效果</p>
            </li>
            <li>
                <a href="#">列表项2</a>
                <p>每个列表项有不同的悬停颜色</p>
            </li>
            <li>
                <a href="#">列表项3</a>
                <p>平滑的过渡动画效果</p>
            </li>
            <li>
                <a href="#">列表项4 - 点击访问示例网站</a>
                <p>更多特效</p>
            </li>
        </ul>
        

    </div>
</body>
</html>

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值