CSS3鼠标悬停图标导航动画

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>CSS3鼠标悬停图标导航动画</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Arial', sans-serif;
        }
        
        body {
            background: #f5f5f5;
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
        }
        
        .nav-container {
            display: flex;
            background: #fff;
            padding: 20px;
            border-radius: 15px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
        }
        
        .nav-item {
            position: relative;
            width: 70px;
            height: 70px;
            margin: 0 10px;
            display: flex;
            justify-content: center;
            align-items: center;
            flex-direction: column;
            cursor: pointer;
            transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
        }
        
        .nav-item .icon {
            position: relative;
            width: 60px;
            height: 60px;
            display: flex;
            justify-content: center;
            align-items: center;
            border-radius: 50%;
            background: #fff;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
            z-index: 2;
            transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
        }
        
        .nav-item .icon i {
            font-size: 24px;
            color: #666;
            transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
        }
        
        .nav-item .title {
            position: absolute;
            top: 0;
            font-size: 14px;
            background: #fff;
            color: #fff;
            padding: 5px 10px;
            border-radius: 30px;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
            opacity: 0;
            transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
        }
        
        .nav-item:hover {
            transform: translateY(-10px);
        }
        
        .nav-item:hover .icon {
            background: linear-gradient(45deg, #8e2de2, #4a00e0);
        }
        
        .nav-item:hover .icon i {
            color: #fff;
        }
        
        .nav-item:hover .title {
            top: -40px;
            opacity: 1;
            background: linear-gradient(45deg, #8e2de2, #4a00e0);
        }
        
        .nav-item:nth-child(1):hover .icon,
        .nav-item:nth-child(1):hover .title {
            background: linear-gradient(45deg, #f12711, #f5af19);
        }
        
        .nav-item:nth-child(2):hover .icon,
        .nav-item:nth-child(2):hover .title {
            background: linear-gradient(45deg, #00b09b, #96c93d);
        }
        
        .nav-item:nth-child(3):hover .icon,
        .nav-item:nth-child(3):hover .title {
            background: linear-gradient(45deg, #fc4a1a, #f7b733);
        }
        
        .nav-item:nth-child(4):hover .icon,
        .nav-item:nth-child(4):hover .title {
            background: linear-gradient(45deg, #8e2de2, #4a00e0);
        }
        
        .nav-item:nth-child(5):hover .icon,
        .nav-item:nth-child(5):hover .title {
            background: linear-gradient(45deg, #11998e, #38ef7d);
        }
        
        .footer {
            position: fixed;
            bottom: 20px;
            color: #666;
            font-size: 12px;
        }
        
        .footer a {
            color: #4a00e0;
            text-decoration: none;
        }
        
        /* 插入的网址样式 */
        .inserted-link {
            display: none;
        }
    </style>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
</head>
<body>
    <div class="nav-container">
        <div class="nav-item">
            <div class="icon">
                <i class="fas fa-home"></i>
            </div>
            <span class="title">首页</span>
        </div>
        <div class="nav-item">
            <div class="icon">
                <i class="fas fa-search"></i>
            </div>
            <span class="title">搜索</span>
        </div>
        <div class="nav-item">
            <div class="icon">
                <i class="fas fa-heart"></i>
            </div>
            <span class="title">收藏</span>
        </div>
        <div class="nav-item">
            <div class="icon">
                <i class="fas fa-user"></i>
            </div>
            <span class="title">我的</span>
        </div>
        <div class="nav-item">
            <div class="icon">
                <i class="fas fa-cog"></i>
            </div>
            <span class="title">设置</span>
        </div>
    </div>
    
    <div class="footer">
        版权所有 © 2023 
    </div>

</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值