bootstrap实现一个侧边栏导航条效果代码
代码语言:html
所属分类:菜单导航
代码描述:bootstrap实现一个侧边栏导航条效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/bootstrap.4.3.1.min.css"> <link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/font-awesome-4.7.0/css/font-awesome.min.css"> <style> html { position: relative; min-height: 100%; } body { padding-top: 4.5rem; margin-bottom: 4.5rem; } .footer { position: absolute; bottom: 0; width: 100%; height: 3.5rem; line-height: 3.5rem; background-color: #ccc; } .nav-link:hover { transition: all 0.4s; } .nav-link-collapse:after { float: right; content: '\f067'; font-family: 'FontAwesome'; } .nav-link-show:after { float: right; content: '\f068'; font-family: 'FontAwesome'; } .nav-item ul.nav-second-level { padding-left: 0; } .nav-item ul.nav-second-level > .nav-item { padding-left: 20px; } @media (min-width: 992px) { .sidenav { position: absolute; top: 0; left: 0; width: 230px; height: calc(100vh - 3.5rem); margin-top: 3.5rem; background: #343a40; box-sizing: border-box; border-top: 1px solid rgba(0, 0, 0, 0.3); } .navbar-expand-lg .sidenav { flex-direction: column; } .content-wrapper { margin-left: 230px; } .footer { width: calc(100% - 230px); margin-left: 230px; } } </style> </head> <body > <nav class="navbar navbar-expand-lg navbar-dark fixed-top bg-dark"> <a class="navbar-brand" href="#">Sidebar Nav</a> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation" > <span class="navbar-toggler-icon"></span> </button> <div class="collapse navbar-collapse" id="navbarCollapse"> <ul class="navbar-nav mr-auto sidenav" id="navAccordion"> <li class="nav-item active"> <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a> </li> <li class="nav-item"> <a class="nav-link" href="#">Item 1</a> </li> <li class="nav-item"> <a class="nav-link nav-link-collapse" href="#" id="hasSubItems" data-toggle="collapse" data-target="#collapseSubItems2" aria-controls="collapseSubItems2" aria-expanded="false" >Item 2</a> <ul class="nav-second-level collapse" id="collapseSubItems2" data-parent="#navAccordion"> <li class="nav-item"> <a class="nav-link" href="#"> .........完整代码请登录后点击上方下载按钮下载查看
网友评论0