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>
        *{
            padding: 0;
            margin: 0;
        }
        body{
            display: flex;
            justify-content: space-evenly;
            align-items: center;
            height: 100vh;
            
        }
        .box{
            /* margin-top: 100px; */
            height: 500px;
            width: 70px;
            background-color: #539ff5;
            border-radius: 10px;
            transition: 0.3s;
        }
        .box:hover{
            width: 195px;
        }
        .box a{
            /* overflow: hidden; */
            margin: 0 auto;
            line-height: 50px;
            color: rgb(71, 71, 71);
            height: 50px;
            width: 88%;
            border-radius: 5px;
            position: relative;
        }
        .box{
            overflow: hidden;
            display: flex;
            flex-direction: column;
            justify-content: space-around;
        }
        .box a:nth-of-type(1)::before,.box a:nth-of-type(5)::before{
            content: "";
            position: absolute;
            bottom: -8px;
            width: 100%;
            border-bottom: 1px solid rgb(165, 173, 201);
        }
        .box a img{
           
            vertical-align: middle;
            margin-left:15px;
            height: 35x;
            width: 35px;
        }
        .box span{
            position:absolute;
            white-space: nowrap;
            transition: 0.3s;
            opacity: 0;
            margin-left: 8px;
            top: 2px;
        }

        .box a:hover{
            color: black;
            background-color: rgba(204, 204, 204,0.5);
        }
        .box:hover span{
           opacity: 1;
        }
            
        
    </style>
</head>
<body>
    <div class="box">
        <a href="#"><img src="icons/1.png" alt=""><span>list</span></a>
        <a href="#"><img src="icons/2.png" alt=""><span>Warehous</span></a>
        <a href="#"><img src="icons/3.png" alt=""><span>theme</span></a>
        <a href="#"><img src="icons/4.png" alt=""><span>wallet</span></a>
        <a href="#"><img src="icons/5.png" alt=""><span>picture</span></a>
        <a href="#"><img src="icons/6.png" alt=""><span>OR code</span></a>
        <a href="#"><img src="icons/7.png" alt=""><span>authentication</span></a>
        <a href="#"><img src="icons/8.png" alt=""><span>cancellation</span></a>
    </div>
</body>
</html>
  • 7
    点赞
  • 41
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值