js+css实现平滑下划线的导航条代码

代码语言:html

所属分类:菜单导航

代码描述:js+css实现平滑下划线的导航条代码

代码标签: js css 平滑 下划线 导航条 代码

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

 
<!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">

    <style>
        *{
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        body{
            height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            background-color: rgb(7, 18, 46);
        }
        .container{
            position: relative;
            width: 700px;
            height: 50px;
            background-color: rgb(30, 45, 112);
            border-radius: 10px;
            display: flex;
            align-items: center;
            justify-content: space-around;
            box-shadow:  1.5px 2px 2px rgb(0, 0, 0),
            inset  3px 3px 4px rgba(255,255,255,0.1);      
        }
        .label{
            width: 100px;
            height: 30px;
            text-align: center;
            line-height: 30px;
            color: rgb(255, 255, 255);
            text-decoration: none; 
            font-size: 14px;
        }
        .line{
            position: absolute;
            left: 20px;
            bottom: 0;
            height: 3px;
            width: 100px;
            background-color: rgb(66, 104, 207);
            border-radius: 2px;
           
        }
        a:hover{
            color: aqua;
        }
       .change{
            color: aqua;          
            border-radius: 10px;
            box-shadow: inset 3px 3px 4px rgb(0, 0, 0),
             1.5px 2px 2px rgba(255,255,255,0.1);      
        }
    </style>
</head>
<body>
    <div class="container">
        <a href="#" class="label ">首页</a>
        <a href="#" class="label">文章</a>
        <a href="#" class="label">留言板</a>
        <a href="#" class="label">介绍</a>
        <a href="#" class="label">其他</a>
        <div class="line"></div>
    </div>
    <script>
        // 获取底层盒子
        var container = document.querySelector('.container');
        // 获取标签
        var labels = document.querySelectorAll(&#.........完整代码请登录后点击上方下载按钮下载查看

网友评论0