"Bootstrap4 navigation border animation- 导航菜单"
Bootstrap 4.1.1 Snippet by 高级放牛娃

<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <nav class="navbar navbar-expand-lg navbar-dark"> <a href="#" class="navbar-brand">Logo</a> <button class="navbar-toggler" type="button" data-target="#navigation"> <span class="navbar-toggler-icon"></span> </button> <div class="collapse navbar-collapse"> <ul class="nav navbar-nav ml-auto"> <li class="nav-item active"> <a href="#" class="nav-link">首页</a> </li> <li class="nav-item dropdown"> <a class="nav-link dropdown-toggle" href="#" id="navdrop" role="button" data-toggle="dropdown" data-hover="dropdown">我的作品</a> <div class="dropdown-menu" aria-labelledby="navdrop"> <a href="#" class="dropdown-item">冰箱运行监视</a> <a href="#" class="dropdown-item">热水器参数</a> <a href="#" class="dropdown-item">家用网关</a> <a href="#" class="dropdown-item">用电量参数</a> <div class="dropdown-divider"></div> <a href="#" class="dropdown-item">无线图像传输</a> </div> </li> <li class="nav-item"> <a href="#" class="nav-link">关于本网站</a> </li> <li class="nav-item"> <a href="#" class="nav-link">关于我</a> </li> <li class="nav-item"> <a href="#" class="nav-link">联系我</a> </li> </ul> </div> </nav>
.navbar{background:#222222;} .nav-item::after{content:'';display:block;width:0px;height:2px;background:#fec400;transition: 0.2s;} .nav-item:hover::after{width:100%;} .navbar-dark .navbar-nav .active > .nav-link, .navbar-dark .navbar-nav .nav-link.active, .navbar-dark .navbar-nav .nav-link.show, .navbar-dark .navbar-nav .show > .nav-link,.navbar-dark .navbar-nav .nav-link:focus, .navbar-dark .navbar-nav .nav-link:hover{color:#fec400;} .nav-link{padding:15px 5px;transition:0.2s;} .dropdown-item.active, .dropdown-item:active{color:#212529;} .dropdown-item:focus, .dropdown-item:hover{background:#fec400;}

Related: See More


Questions / Comments: