2022-05-14 01:19:48 +08:00
<!doctype html>
< html lang = "en" >
< head >
< meta charset = "utf-8" >
< meta name = "viewport" content = "width=device-width, initial-scale=1" >
< meta name = "description" content = "" >
< meta name = "author" content = "Mark Otto, Jacob Thornton, and Bootstrap contributors" >
2022-07-19 23:48:29 +08:00
< meta name = "generator" content = "Hugo 0.101.0" >
2022-05-14 01:19:48 +08:00
< title > Navbar Template · Bootstrap v5.2< / title >
< link rel = "canonical" href = "https://getbootstrap.com/docs/5.2/examples/navbars/" >
2022-09-07 23:36:43 +08:00
< link href = "/docs/5.2/dist/css/bootstrap.min.css" rel = "stylesheet" integrity = "sha384-iYQeCzEYFbKjA/T2uDLTpkwGzCiq6soy8tYaI1GyVh/UjpbCx/TYkiZhlZB6+fzT" crossorigin = "anonymous" >
2022-05-14 01:19:48 +08:00
<!-- Favicons -->
< link rel = "apple-touch-icon" href = "/docs/5.2/assets/img/favicons/apple-touch-icon.png" sizes = "180x180" >
< link rel = "icon" href = "/docs/5.2/assets/img/favicons/favicon-32x32.png" sizes = "32x32" type = "image/png" >
< link rel = "icon" href = "/docs/5.2/assets/img/favicons/favicon-16x16.png" sizes = "16x16" type = "image/png" >
< link rel = "manifest" href = "/docs/5.2/assets/img/favicons/manifest.json" >
< link rel = "mask-icon" href = "/docs/5.2/assets/img/favicons/safari-pinned-tab.svg" color = "#712cf9" >
< link rel = "icon" href = "/docs/5.2/assets/img/favicons/favicon.ico" >
< meta name = "theme-color" content = "#712cf9" >
< style >
.bd-placeholder-img {
font-size: 1.125rem;
text-anchor: middle;
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
}
@media (min-width: 768px) {
.bd-placeholder-img-lg {
font-size: 3.5rem;
}
}
.b-example-divider {
height: 3rem;
background-color: rgba(0, 0, 0, .1);
border: solid rgba(0, 0, 0, .15);
border-width: 1px 0;
box-shadow: inset 0 .5em 1.5em rgba(0, 0, 0, .1), inset 0 .125em .5em rgba(0, 0, 0, .15);
}
.b-example-vr {
flex-shrink: 0;
width: 1.5rem;
height: 100vh;
}
.bi {
vertical-align: -.125em;
fill: currentColor;
}
.nav-scroller {
position: relative;
z-index: 2;
height: 2.75rem;
overflow-y: hidden;
}
.nav-scroller .nav {
display: flex;
flex-wrap: nowrap;
padding-bottom: 1rem;
margin-top: -1px;
overflow-x: auto;
text-align: center;
white-space: nowrap;
-webkit-overflow-scrolling: touch;
}
< / style >
<!-- Custom styles for this template -->
< link href = "navbar.css" rel = "stylesheet" >
< / head >
< body >
< main >
< nav class = "navbar navbar-dark bg-dark" aria-label = "First navbar example" >
< div class = "container-fluid" >
< a class = "navbar-brand" href = "#" > Never expand< / a >
< button class = "navbar-toggler" type = "button" data-bs-toggle = "collapse" data-bs-target = "#navbarsExample01" aria-controls = "navbarsExample01" aria-expanded = "false" aria-label = "Toggle navigation" >
< span class = "navbar-toggler-icon" > < / span >
< / button >
< div class = "collapse navbar-collapse" id = "navbarsExample01" >
< ul class = "navbar-nav me-auto mb-2" >
< li class = "nav-item" >
< a class = "nav-link active" aria-current = "page" href = "#" > Home< / a >
< / li >
< li class = "nav-item" >
< a class = "nav-link" href = "#" > Link< / a >
< / li >
< li class = "nav-item" >
< a class = "nav-link disabled" > Disabled< / a >
< / li >
< li class = "nav-item dropdown" >
2022-07-19 23:48:29 +08:00
< a class = "nav-link dropdown-toggle" href = "#" data-bs-toggle = "dropdown" aria-expanded = "false" > Dropdown< / a >
< ul class = "dropdown-menu" >
2022-05-14 01:19:48 +08:00
< li > < a class = "dropdown-item" href = "#" > Action< / a > < / li >
< li > < a class = "dropdown-item" href = "#" > Another action< / a > < / li >
< li > < a class = "dropdown-item" href = "#" > Something else here< / a > < / li >
< / ul >
< / li >
< / ul >
< form role = "search" >
< input class = "form-control" type = "search" placeholder = "Search" aria-label = "Search" >
< / form >
< / div >
< / div >
< / nav >
< nav class = "navbar navbar-expand navbar-dark bg-dark" aria-label = "Second navbar example" >
< div class = "container-fluid" >
< a class = "navbar-brand" href = "#" > Always expand< / a >
< button class = "navbar-toggler" type = "button" data-bs-toggle = "collapse" data-bs-target = "#navbarsExample02" aria-controls = "navbarsExample02" aria-expanded = "false" aria-label = "Toggle navigation" >
< span class = "navbar-toggler-icon" > < / span >
< / button >
< div class = "collapse navbar-collapse" id = "navbarsExample02" >
< ul class = "navbar-nav me-auto" >
< li class = "nav-item" >
< a class = "nav-link active" aria-current = "page" href = "#" > Home< / a >
< / li >
< li class = "nav-item" >
< a class = "nav-link" href = "#" > Link< / a >
< / li >
< / ul >
< form role = "search" >
< input class = "form-control" type = "search" placeholder = "Search" aria-label = "Search" >
< / form >
< / div >
< / div >
< / nav >
< nav class = "navbar navbar-expand-sm navbar-dark bg-dark" aria-label = "Third navbar example" >
< div class = "container-fluid" >
< a class = "navbar-brand" href = "#" > Expand at sm< / a >
< button class = "navbar-toggler" type = "button" data-bs-toggle = "collapse" data-bs-target = "#navbarsExample03" aria-controls = "navbarsExample03" aria-expanded = "false" aria-label = "Toggle navigation" >
< span class = "navbar-toggler-icon" > < / span >
< / button >
< div class = "collapse navbar-collapse" id = "navbarsExample03" >
< ul class = "navbar-nav me-auto mb-2 mb-sm-0" >
< li class = "nav-item" >
< a class = "nav-link active" aria-current = "page" href = "#" > Home< / a >
< / li >
< li class = "nav-item" >
< a class = "nav-link" href = "#" > Link< / a >
< / li >
< li class = "nav-item" >
< a class = "nav-link disabled" > Disabled< / a >
< / li >
< li class = "nav-item dropdown" >
2022-07-19 23:48:29 +08:00
< a class = "nav-link dropdown-toggle" href = "#" data-bs-toggle = "dropdown" aria-expanded = "false" > Dropdown< / a >
< ul class = "dropdown-menu" >
2022-05-14 01:19:48 +08:00
< li > < a class = "dropdown-item" href = "#" > Action< / a > < / li >
< li > < a class = "dropdown-item" href = "#" > Another action< / a > < / li >
< li > < a class = "dropdown-item" href = "#" > Something else here< / a > < / li >
< / ul >
< / li >
< / ul >
< form role = "search" >
< input class = "form-control" type = "search" placeholder = "Search" aria-label = "Search" >
< / form >
< / div >
< / div >
< / nav >
< nav class = "navbar navbar-expand-md navbar-dark bg-dark" aria-label = "Fourth navbar example" >
< div class = "container-fluid" >
< a class = "navbar-brand" href = "#" > Expand at md< / a >
< button class = "navbar-toggler" type = "button" data-bs-toggle = "collapse" data-bs-target = "#navbarsExample04" aria-controls = "navbarsExample04" aria-expanded = "false" aria-label = "Toggle navigation" >
< span class = "navbar-toggler-icon" > < / span >
< / button >
< div class = "collapse navbar-collapse" id = "navbarsExample04" >
< ul class = "navbar-nav me-auto mb-2 mb-md-0" >
< li class = "nav-item" >
< a class = "nav-link active" aria-current = "page" href = "#" > Home< / a >
< / li >
< li class = "nav-item" >
< a class = "nav-link" href = "#" > Link< / a >
< / li >
< li class = "nav-item" >
< a class = "nav-link disabled" > Disabled< / a >
< / li >
< li class = "nav-item dropdown" >
2022-07-19 23:48:29 +08:00
< a class = "nav-link dropdown-toggle" href = "#" data-bs-toggle = "dropdown" aria-expanded = "false" > Dropdown< / a >
< ul class = "dropdown-menu" >
2022-05-14 01:19:48 +08:00
< li > < a class = "dropdown-item" href = "#" > Action< / a > < / li >
< li > < a class = "dropdown-item" href = "#" > Another action< / a > < / li >
< li > < a class = "dropdown-item" href = "#" > Something else here< / a > < / li >
< / ul >
< / li >
< / ul >
< form role = "search" >
< input class = "form-control" type = "search" placeholder = "Search" aria-label = "Search" >
< / form >
< / div >
< / div >
< / nav >
< nav class = "navbar navbar-expand-lg navbar-dark bg-dark" aria-label = "Fifth navbar example" >
< div class = "container-fluid" >
< a class = "navbar-brand" href = "#" > Expand at lg< / a >
< button class = "navbar-toggler" type = "button" data-bs-toggle = "collapse" data-bs-target = "#navbarsExample05" aria-controls = "navbarsExample05" aria-expanded = "false" aria-label = "Toggle navigation" >
< span class = "navbar-toggler-icon" > < / span >
< / button >
< div class = "collapse navbar-collapse" id = "navbarsExample05" >
< ul class = "navbar-nav me-auto mb-2 mb-lg-0" >
< li class = "nav-item" >
< a class = "nav-link active" aria-current = "page" href = "#" > Home< / a >
< / li >
< li class = "nav-item" >
< a class = "nav-link" href = "#" > Link< / a >
< / li >
< li class = "nav-item" >
< a class = "nav-link disabled" > Disabled< / a >
< / li >
< li class = "nav-item dropdown" >
2022-07-19 23:48:29 +08:00
< a class = "nav-link dropdown-toggle" href = "#" data-bs-toggle = "dropdown" aria-expanded = "false" > Dropdown< / a >
< ul class = "dropdown-menu" >
2022-05-14 01:19:48 +08:00
< li > < a class = "dropdown-item" href = "#" > Action< / a > < / li >
< li > < a class = "dropdown-item" href = "#" > Another action< / a > < / li >
< li > < a class = "dropdown-item" href = "#" > Something else here< / a > < / li >
< / ul >
< / li >
< / ul >
< form role = "search" >
< input class = "form-control" type = "search" placeholder = "Search" aria-label = "Search" >
< / form >
< / div >
< / div >
< / nav >
< nav class = "navbar navbar-expand-xl navbar-dark bg-dark" aria-label = "Sixth navbar example" >
< div class = "container-fluid" >
< a class = "navbar-brand" href = "#" > Expand at xl< / a >
< button class = "navbar-toggler" type = "button" data-bs-toggle = "collapse" data-bs-target = "#navbarsExample06" aria-controls = "navbarsExample06" aria-expanded = "false" aria-label = "Toggle navigation" >
< span class = "navbar-toggler-icon" > < / span >
< / button >
< div class = "collapse navbar-collapse" id = "navbarsExample06" >
< ul class = "navbar-nav me-auto mb-2 mb-xl-0" >
< li class = "nav-item" >
< a class = "nav-link active" aria-current = "page" href = "#" > Home< / a >
< / li >
< li class = "nav-item" >
< a class = "nav-link" href = "#" > Link< / a >
< / li >
< li class = "nav-item" >
< a class = "nav-link disabled" > Disabled< / a >
< / li >
< li class = "nav-item dropdown" >
2022-07-19 23:48:29 +08:00
< a class = "nav-link dropdown-toggle" href = "#" data-bs-toggle = "dropdown" aria-expanded = "false" > Dropdown< / a >
< ul class = "dropdown-menu" >
2022-05-14 01:19:48 +08:00
< li > < a class = "dropdown-item" href = "#" > Action< / a > < / li >
< li > < a class = "dropdown-item" href = "#" > Another action< / a > < / li >
< li > < a class = "dropdown-item" href = "#" > Something else here< / a > < / li >
< / ul >
< / li >
< / ul >
< form role = "search" >
< input class = "form-control" type = "search" placeholder = "Search" aria-label = "Search" >
< / form >
< / div >
< / div >
< / nav >
< nav class = "navbar navbar-expand-xxl navbar-dark bg-dark" aria-label = "Seventh navbar example" >
< div class = "container-fluid" >
< a class = "navbar-brand" href = "#" > Expand at xxl< / a >
< button class = "navbar-toggler" type = "button" data-bs-toggle = "collapse" data-bs-target = "#navbarsExampleXxl" aria-controls = "navbarsExampleXxl" aria-expanded = "false" aria-label = "Toggle navigation" >
< span class = "navbar-toggler-icon" > < / span >
< / button >
< div class = "collapse navbar-collapse" id = "navbarsExampleXxl" >
< ul class = "navbar-nav me-auto mb-2 mb-xl-0" >
< li class = "nav-item" >
< a class = "nav-link active" aria-current = "page" href = "#" > Home< / a >
< / li >
< li class = "nav-item" >
< a class = "nav-link" href = "#" > Link< / a >
< / li >
< li class = "nav-item" >
< a class = "nav-link disabled" > Disabled< / a >
< / li >
< li class = "nav-item dropdown" >
2022-07-19 23:48:29 +08:00
< a class = "nav-link dropdown-toggle" href = "#" data-bs-toggle = "dropdown" aria-expanded = "false" > Dropdown< / a >
< ul class = "dropdown-menu" >
2022-05-14 01:19:48 +08:00
< li > < a class = "dropdown-item" href = "#" > Action< / a > < / li >
< li > < a class = "dropdown-item" href = "#" > Another action< / a > < / li >
< li > < a class = "dropdown-item" href = "#" > Something else here< / a > < / li >
< / ul >
< / li >
< / ul >
< form role = "search" >
< input class = "form-control" type = "search" placeholder = "Search" aria-label = "Search" >
< / form >
< / div >
< / div >
< / nav >
< nav class = "navbar navbar-expand-lg navbar-dark bg-dark" aria-label = "Eighth navbar example" >
< div class = "container" >
< a class = "navbar-brand" href = "#" > Container< / a >
< button class = "navbar-toggler" type = "button" data-bs-toggle = "collapse" data-bs-target = "#navbarsExample07" aria-controls = "navbarsExample07" aria-expanded = "false" aria-label = "Toggle navigation" >
< span class = "navbar-toggler-icon" > < / span >
< / button >
< div class = "collapse navbar-collapse" id = "navbarsExample07" >
< ul class = "navbar-nav me-auto mb-2 mb-lg-0" >
< li class = "nav-item" >
< a class = "nav-link active" aria-current = "page" href = "#" > Home< / a >
< / li >
< li class = "nav-item" >
< a class = "nav-link" href = "#" > Link< / a >
< / li >
< li class = "nav-item" >
< a class = "nav-link disabled" > Disabled< / a >
< / li >
< li class = "nav-item dropdown" >
2022-07-19 23:48:29 +08:00
< a class = "nav-link dropdown-toggle" href = "#" data-bs-toggle = "dropdown" aria-expanded = "false" > Dropdown< / a >
< ul class = "dropdown-menu" >
2022-05-14 01:19:48 +08:00
< li > < a class = "dropdown-item" href = "#" > Action< / a > < / li >
< li > < a class = "dropdown-item" href = "#" > Another action< / a > < / li >
< li > < a class = "dropdown-item" href = "#" > Something else here< / a > < / li >
< / ul >
< / li >
< / ul >
< form role = "search" >
< input class = "form-control" type = "search" placeholder = "Search" aria-label = "Search" >
< / form >
< / div >
< / div >
< / nav >
< nav class = "navbar navbar-expand-lg navbar-dark bg-dark" aria-label = "Ninth navbar example" >
< div class = "container-xl" >
< a class = "navbar-brand" href = "#" > Container XL< / a >
< button class = "navbar-toggler" type = "button" data-bs-toggle = "collapse" data-bs-target = "#navbarsExample07XL" aria-controls = "navbarsExample07XL" aria-expanded = "false" aria-label = "Toggle navigation" >
< span class = "navbar-toggler-icon" > < / span >
< / button >
< div class = "collapse navbar-collapse" id = "navbarsExample07XL" >
< ul class = "navbar-nav me-auto mb-2 mb-lg-0" >
< li class = "nav-item" >
< a class = "nav-link active" aria-current = "page" href = "#" > Home< / a >
< / li >
< li class = "nav-item" >
< a class = "nav-link" href = "#" > Link< / a >
< / li >
< li class = "nav-item" >
< a class = "nav-link disabled" > Disabled< / a >
< / li >
< li class = "nav-item dropdown" >
2022-07-19 23:48:29 +08:00
< a class = "nav-link dropdown-toggle" href = "#" data-bs-toggle = "dropdown" aria-expanded = "false" > Dropdown< / a >
< ul class = "dropdown-menu" >
2022-05-14 01:19:48 +08:00
< li > < a class = "dropdown-item" href = "#" > Action< / a > < / li >
< li > < a class = "dropdown-item" href = "#" > Another action< / a > < / li >
< li > < a class = "dropdown-item" href = "#" > Something else here< / a > < / li >
< / ul >
< / li >
< / ul >
< form role = "search" >
< input class = "form-control" type = "search" placeholder = "Search" aria-label = "Search" >
< / form >
< / div >
< / div >
< / nav >
< div class = "container-xl mb-4" >
< p > Matching .container-xl...< / p >
< / div >
< nav class = "navbar navbar-expand-lg navbar-dark bg-dark" aria-label = "Tenth navbar example" >
< div class = "container-fluid" >
< button class = "navbar-toggler" type = "button" data-bs-toggle = "collapse" data-bs-target = "#navbarsExample08" aria-controls = "navbarsExample08" aria-expanded = "false" aria-label = "Toggle navigation" >
< span class = "navbar-toggler-icon" > < / span >
< / button >
< div class = "collapse navbar-collapse justify-content-md-center" id = "navbarsExample08" >
< ul class = "navbar-nav" >
< li class = "nav-item" >
< a class = "nav-link active" aria-current = "page" href = "#" > Centered nav only< / a >
< / li >
< li class = "nav-item" >
< a class = "nav-link" href = "#" > Link< / a >
< / li >
< li class = "nav-item" >
< a class = "nav-link disabled" > Disabled< / a >
< / li >
< li class = "nav-item dropdown" >
2022-07-19 23:48:29 +08:00
< a class = "nav-link dropdown-toggle" href = "#" data-bs-toggle = "dropdown" aria-expanded = "false" > Dropdown< / a >
< ul class = "dropdown-menu" >
2022-05-14 01:19:48 +08:00
< li > < a class = "dropdown-item" href = "#" > Action< / a > < / li >
< li > < a class = "dropdown-item" href = "#" > Another action< / a > < / li >
< li > < a class = "dropdown-item" href = "#" > Something else here< / a > < / li >
< / ul >
< / li >
< / ul >
< / div >
< / div >
< / nav >
< div class = "container" >
< nav class = "navbar navbar-expand-lg bg-light rounded" aria-label = "Eleventh navbar example" >
< div class = "container-fluid" >
< a class = "navbar-brand" href = "#" > Navbar< / a >
< button class = "navbar-toggler" type = "button" data-bs-toggle = "collapse" data-bs-target = "#navbarsExample09" aria-controls = "navbarsExample09" aria-expanded = "false" aria-label = "Toggle navigation" >
< span class = "navbar-toggler-icon" > < / span >
< / button >
< div class = "collapse navbar-collapse" id = "navbarsExample09" >
< ul class = "navbar-nav me-auto mb-2 mb-lg-0" >
< li class = "nav-item" >
< a class = "nav-link active" aria-current = "page" href = "#" > Home< / a >
< / li >
< li class = "nav-item" >
< a class = "nav-link" href = "#" > Link< / a >
< / li >
< li class = "nav-item" >
< a class = "nav-link disabled" > Disabled< / a >
< / li >
< li class = "nav-item dropdown" >
2022-07-19 23:48:29 +08:00
< a class = "nav-link dropdown-toggle" href = "#" data-bs-toggle = "dropdown" aria-expanded = "false" > Dropdown< / a >
< ul class = "dropdown-menu" >
2022-05-14 01:19:48 +08:00
< li > < a class = "dropdown-item" href = "#" > Action< / a > < / li >
< li > < a class = "dropdown-item" href = "#" > Another action< / a > < / li >
< li > < a class = "dropdown-item" href = "#" > Something else here< / a > < / li >
< / ul >
< / li >
< / ul >
< form role = "search" >
< input class = "form-control" type = "search" placeholder = "Search" aria-label = "Search" >
< / form >
< / div >
< / div >
< / nav >
< nav class = "navbar navbar-expand-lg bg-light rounded" aria-label = "Twelfth navbar example" >
< div class = "container-fluid" >
< button class = "navbar-toggler" type = "button" data-bs-toggle = "collapse" data-bs-target = "#navbarsExample10" aria-controls = "navbarsExample10" aria-expanded = "false" aria-label = "Toggle navigation" >
< span class = "navbar-toggler-icon" > < / span >
< / button >
< div class = "collapse navbar-collapse justify-content-md-center" id = "navbarsExample10" >
< ul class = "navbar-nav" >
< li class = "nav-item" >
< a class = "nav-link active" aria-current = "page" href = "#" > Centered nav only< / a >
< / li >
< li class = "nav-item" >
< a class = "nav-link" href = "#" > Link< / a >
< / li >
< li class = "nav-item" >
< a class = "nav-link disabled" > Disabled< / a >
< / li >
< li class = "nav-item dropdown" >
2022-07-19 23:48:29 +08:00
< a class = "nav-link dropdown-toggle" href = "#" data-bs-toggle = "dropdown" aria-expanded = "false" > Dropdown< / a >
< ul class = "dropdown-menu" >
2022-05-14 01:19:48 +08:00
< li > < a class = "dropdown-item" href = "#" > Action< / a > < / li >
< li > < a class = "dropdown-item" href = "#" > Another action< / a > < / li >
< li > < a class = "dropdown-item" href = "#" > Something else here< / a > < / li >
< / ul >
< / li >
< / ul >
< / div >
< / div >
< / nav >
< div >
< div class = "bg-light p-5 rounded" >
< div class = "col-sm-8 mx-auto" >
< h1 > Navbar examples< / h1 >
< p > This example is a quick exercise to illustrate how the navbar and its contents work. Some navbars extend the width of the viewport, others are confined within a < code > .container< / code > . For positioning of navbars, checkout the < a href = "/docs/5.2/examples/navbar-static/" > top< / a > and < a href = "/docs/5.2/examples/navbar-fixed/" > fixed top< / a > examples.< / p >
< p > At the smallest breakpoint, the collapse plugin is used to hide the links and show a menu button to toggle the collapsed content.< / p >
< p >
< a class = "btn btn-primary" href = "/docs/5.2/components/navbar/" role = "button" > View navbar docs » < / a >
< / p >
< / div >
< / div >
< / div >
< / div >
< / main >
2022-09-07 23:36:43 +08:00
< script src = "/docs/5.2/dist/js/bootstrap.bundle.min.js" integrity = "sha384-u1OknCvxWvY5kfmNBILK2hRnQC3Pr17a+RTT6rIHI7NnikvbZlHgTPOOmMi466C8" crossorigin = "anonymous" > < / script >
2022-05-14 01:19:48 +08:00
< / body >
< / html >