Navbar rehegua
Kuatiahaipyre ha techapyrã Bootstrap iñakãrapuꞌa jeguatarã ipuꞌakapávape g̃uarã, navbar. Oike pytyvõ marca, jeguata ha hetave mba’e, oikehápe pytyvõ ore plugin colapso rehegua.
Mba’éichapa omba’apo
Ko’ápe oĩ mba’épa tekotevẽ reikuaa reñepyrũ mboyve navbar reheve:
- Umi navbar oikotevẽ peteĩ envoltura
.navbar
ndive umi clase de.navbar-expand{-sm|-md|-lg|-xl|-xxl}
colapso ha esquema de color ombohováivape g̃uarã. - Umi Navbar ha ipypegua haꞌehína fluido por defecto. Emoambue mba yru omombyte hagua ipypuku horizontal opaichagua hendáicha.
- Eipuru ore clase utilidad espaciado ha flex rehegua econtrola hag̃ua espaciado ha alineación navbar ryepýpe.
- Umi Navbar ombohovái por defecto, ha katu ikatu remoambue pya’e remoambue hag̃ua upéva. Teko ombohováiva odepende ore Collapse JavaScript plugin rehe.
- Ojeasegura ojeikekuaaha ojeporúvo peteĩ
<nav>
elemento térã, ojeporúramo peteĩ elemento genéricovéva haꞌeháicha peteĩ<div>
, emoĩ peteĩrole="navigation"
opaite navbar-pe ojekuaa hag̃ua hesakã porãme haꞌeha peteĩ región hito rehegua umi oiporúvape g̃uarã umi tecnología oipytyvõva. - Ehechauka mbaꞌe koꞌag̃agua eipurúvo
aria-current="page"
páhina koꞌag̃aguápearia-current="true"
g̃uarã térã mbaꞌe koꞌag̃aguápe g̃uarã peteĩ aty’ípe.
prefers-reduced-motion
consulta medio rehegua rehe. Ehecha pe
sección movimiento reducido ore kuatia accesibilidad rehegua .
Contenido oipytyvõva
Umi Navbar oúva pytyvõ incorporado reheve peteĩ pokõi subcomponente-pe g̃uarã. Eiporavo ko’ãva apytégui tekotevẽháicha:
.navbar-brand
ne empresa, producto térã proyecto rérape g̃uarã..navbar-nav
peteĩ navegación ijyvatetereíva ha ligero-pe g̃uarã (oikehápe pytyvõ umi desplegable-pe g̃uarã)..navbar-toggler
ojepuru hag̃ua ore plugin de collapso ha ambue jepokuaa jeguata jeguerahauka rehegua ndive .- Utilidades de flexión ha espaciado oimeraẽva control ha acción formulario rehegua.
.navbar-text
oñembojoapy hag̃ua jehaipyre vore oñembohapéva verticalmente..collapse.navbar-collapse
oñemboaty ha oñeñomi hag̃ua navbar contenido peteĩ punto de ruptura tuvakuéra rupive.- Emoĩ peteĩ opcional
.navbar-scroll
emohenda hag̃ua peteĩmax-height
ha eñemongu’e navbar contenido oñembotuicháva .
Ko’ápe oĩ peteĩ techapyrã opaite subcomponente oikeva’ekue peteĩ navbar ombohováiva tesape rehegua ho’áva ijeheguiete lg
punto de ruptura (tuichávape).
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
<a class="navbar-brand" href="#">Navbar</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<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 dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
Dropdown
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
<li><a class="dropdown-item" href="#">Action</a></li>
<li><a class="dropdown-item" href="#">Another action</a></li>
<li><hr class="dropdown-divider"></li>
<li><a class="dropdown-item" href="#">Something else here</a></li>
</ul>
</li>
<li class="nav-item">
<a class="nav-link disabled">Disabled</a>
</li>
</ul>
<form class="d-flex">
<input class="form-control me-2" type="search" placeholder="Search" aria-label="Search">
<button class="btn btn-outline-success" type="submit">Search</button>
</form>
</div>
</div>
</nav>
Ko techapyrã oipuru umi clase utilidad fondo ( bg-light
) ha espaciado ( my-2
, my-lg-0
, me-sm-0
, ) rehegua.my-sm-0
Téra
The .navbar-brand
ikatu ojeporu hetavéva elemento-pe, ha katu peteĩ ancla ombaꞌapo porãve, oĩgui elemento ikatúva oikotevẽ clase utilidad rehegua térã estilo personalizado.
Maranduhai
Emoĩ nde jehaipyre peteĩ elemento ryepýpe .navbar-brand
mbo’esyry ndive.
<!-- As a link -->
<nav class="navbar navbar-light bg-light">
<div class="container-fluid">
<a class="navbar-brand" href="#">Navbar</a>
</div>
</nav>
<!-- As a heading -->
<nav class="navbar navbar-light bg-light">
<div class="container-fluid">
<span class="navbar-brand mb-0 h1">Navbar</span>
</div>
</nav>
Ta'ãnga
Ikatu remyengovia jehaipyre oĩva ryepýpe .navbar-brand
peteĩ <img>
.
<nav class="navbar navbar-light bg-light">
<div class="container">
<a class="navbar-brand" href="#">
<img src="/docs/5.1/assets/brand/bootstrap-logo.svg" alt="" width="30" height="24">
</a>
</div>
</nav>
Ta’anga ha jehaipyre
Ikatu avei eipuru peteĩva umi utilidad adicional emoĩ hag̃ua peteĩ taꞌãngamýi ha jehaipyre peteĩ jave. Ñañamindu’u oñembojoapýha .d-inline-block
ha .align-text-top
hesegua <img>
.
<nav class="navbar navbar-light bg-light">
<div class="container-fluid">
<a class="navbar-brand" href="#">
<img src="/docs/5.1/assets/brand/bootstrap-logo.svg" alt="" width="30" height="24" class="d-inline-block align-text-top">
Bootstrap
</a>
</div>
</nav>
Nav
Umi enlace navegación rehegua omopu’ã ñande .nav
opción-kuéra rehe iclase modificador imba’éva reheve ha oikotevẽ ojepuru umi clase toggler estilo ombohováiva hekopete. Navbar-pe jeguata okakuaáta avei oguereko hag̃ua heta espacio horizontal ikatuháicha eñongatu hag̃ua ne navbar contenido oñemohenda porã hag̃ua.
Emoĩve pe .active
clase .nav-link
ehechauka hag̃ua pe páhina koʼag̃agua.
Eñatendéke emoĩva’erãha avei aria-current
atributo activo rehe .nav-link
.
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
<a class="navbar-brand" href="#">Navbar</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
<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="#">Features</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Pricing</a>
</li>
<li class="nav-item">
<a class="nav-link disabled">Disabled</a>
</li>
</ul>
</div>
</div>
</nav>
Ha roiporúgui clase ore navs-pe g̃uarã, ikatu rejehekýi pe enfoque basado en lista-gui enteramente reipotáramo.
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
<a class="navbar-brand" href="#">Navbar</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNavAltMarkup">
<div class="navbar-nav">
<a class="nav-link active" aria-current="page" href="#">Home</a>
<a class="nav-link" href="#">Features</a>
<a class="nav-link" href="#">Pricing</a>
<a class="nav-link disabled">Disabled</a>
</div>
</div>
</div>
</nav>
Ikatu avei reipuru umi desplegable nde navbar-pe. Umi menú desplegable oikotevẽ peteĩ elemento envoltura oñemohenda hag̃ua, upévare eñangareko eipuru hag̃ua elemento añónte ha anidado ojehechaukaháicha .nav-item
ha .nav-link
ojehechaukaháicha iguýpe.
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
<a class="navbar-brand" href="#">Navbar</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNavDropdown">
<ul class="navbar-nav">
<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="#">Features</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Pricing</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" role="button" data-bs-toggle="dropdown" aria-expanded="false">
Dropdown link
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<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>
Umi Formulario rehegua
Emoĩ opaichagua control ha componente formulario rehegua peteĩ navbar ryepýpe:
<nav class="navbar navbar-light bg-light">
<div class="container-fluid">
<form class="d-flex">
<input class="form-control me-2" type="search" placeholder="Search" aria-label="Search">
<button class="btn btn-outline-success" type="submit">Search</button>
</form>
</div>
</nav>
Pya’e mitã elemento .navbar
jepuru flex diseño ha oñemoĩta por defecto justify-content: space-between
. Eipuru utilidad flex adicional oñeikotevẽháicha emohenda hag̃ua ko jepokuaa.
<nav class="navbar navbar-light bg-light">
<div class="container-fluid">
<a class="navbar-brand">Navbar</a>
<form class="d-flex">
<input class="form-control me-2" type="search" placeholder="Search" aria-label="Search">
<button class="btn btn-outline-success" type="submit">Search</button>
</form>
</div>
</nav>
Umi grupo de entrada omba’apo, avei. Nde navbar haꞌeramo peteĩ formulario tuichakue, térã hetave peteĩ formulario, ikatu eipuru <form>
elemento mbaꞌeryru ramo ha eñongatu michĩmi HTML.
<nav class="navbar navbar-light bg-light">
<form class="container-fluid">
<div class="input-group">
<span class="input-group-text" id="basic-addon1">@</span>
<input type="text" class="form-control" placeholder="Username" aria-label="Username" aria-describedby="basic-addon1">
</div>
</form>
</nav>
Opaichagua botón oñepytyvõ ko’ã formulario navbar ryepýpe, avei. Kóva haꞌe avei peteĩ tuicha manduꞌa ikatuha ojepuru umi utilidad alineación vertical rehegua oñemohenda hag̃ua umi elemento tuichakue iñambuéva.
<nav class="navbar navbar-light bg-light">
<form class="container-fluid justify-content-start">
<button class="btn btn-outline-success me-2" type="button">Main button</button>
<button class="btn btn-sm btn-outline-secondary" type="button">Smaller button</button>
</form>
</nav>
Maranduhai
Umi Navbar ikatu oguereko jehaipyre pehẽngue pytyvõ rupive .navbar-text
. Ko mboꞌepy omohenda alineación vertical ha espaciado horizontal umi cadena jehaipyre rehegua.
<nav class="navbar navbar-light bg-light">
<div class="container-fluid">
<span class="navbar-text">
Navbar text with an inline element
</span>
</div>
</nav>
Oñembojehe’a ha oñembojoaju ambue componente ha utilidad ndive oñeikotevẽháicha.
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
<a class="navbar-brand" href="#">Navbar w/ text</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarText" aria-controls="navbarText" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarText">
<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="#">Features</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Pricing</a>
</li>
</ul>
<span class="navbar-text">
Navbar text with an inline element
</span>
</div>
</div>
</nav>
Umi esquema de colores rehegua
Pe temática pe navbar araka’eve ndaha’éikuri ndahasýiva oñembojoajúgui umi clase ha background-color
utilidad temática rehegua. Eiporavo apytégui .navbar-light
ojepuru hag̃ua tapykuehoha sa’ykuéra ndive, térã .navbar-dark
tapykuehoha sa’ykuéra iñypytũvape g̃uarã. Upéi, emohenda umi .bg-*
utilidad ndive.
<nav class="navbar navbar-dark bg-dark">
<!-- Navbar content -->
</nav>
<nav class="navbar navbar-dark bg-primary">
<!-- Navbar content -->
</nav>
<nav class="navbar navbar-light" style="background-color: #e3f2fd;">
<!-- Navbar content -->
</nav>
Mba’yrukuéra
Jepémo noñeikotevẽi, ikatu embojere peteĩ navbar peteĩ .container
-pe emombyte hag̃ua peteĩ página-pe–jepémo eñatendéke oñeikotevẽha gueteri peteĩ mba’yru hyepypegua. Térã ikatu emoĩ peteĩ mba’yru ryepýpe oĩva .navbar
emombyte hag̃uánte umi mba’e oĩva peteĩ navbar yvategua fijo térã estático-pe .
<div class="container">
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
<a class="navbar-brand" href="#">Navbar</a>
</div>
</nav>
</div>
Eipuru oimeraẽva umi mba’e’oka ombohováiva emoambue hag̃ua mba’éichapa tuicha oñepresenta umi mba’ekuaarã oĩva nde navbar-pe.
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-md">
<a class="navbar-brand" href="#">Navbar</a>
</div>
</nav>
Oñemohenda haguã
Eipuru ore utilidad tenda rehegua emoĩ hag̃ua navbar umi tenda ndahaꞌeiva estática-pe. Eiporavo oñemboguapyvaꞌekue yvate gotyo, oñemboguapyvaꞌekue iguy gotyo térã ojepysóva yvate gotyo (ojedesplaza pe páhina ndive og̃uahẽ meve yvate gotyo, upéi opyta upépe). Umi navbar oñemyatyrõva oipuru position: fixed
, heꞌiséva ojeipeꞌaha DOM jeguata jepiguágui ha ikatu oikotevẽ CSS jeporupyre (techapyrã, ) padding-top
rehe <body>
ani hag̃ua oñembojeheꞌa ambue elemento ndive.
Avei eñatendéke .sticky-top
oipuruha position: sticky
, ndojeguerohorýiva opaite kundahárape .
<nav class="navbar navbar-light bg-light">
<div class="container-fluid">
<a class="navbar-brand" href="#">Default</a>
</div>
</nav>
<nav class="navbar fixed-top navbar-light bg-light">
<div class="container-fluid">
<a class="navbar-brand" href="#">Fixed top</a>
</div>
</nav>
<nav class="navbar fixed-bottom navbar-light bg-light">
<div class="container-fluid">
<a class="navbar-brand" href="#">Fixed bottom</a>
</div>
</nav>
<nav class="navbar sticky-top navbar-light bg-light">
<div class="container-fluid">
<a class="navbar-brand" href="#">Sticky top</a>
</div>
</nav>
Ojedesplazávo
Emoĩ .navbar-nav-scroll
peteĩ .navbar-nav
(térã ambue subcomponente navbar-pe) emboguata hag̃ua desplazamiento vertical umi contenido oñembohasáva ryepýpe peteĩ navbar oñembyaíva ryepýpe. Por defecto, desplazamiento oñepyrũ 75vh
(térã 75% jehechaukaha yvatekuégui), ha katu ikatu embogue upéva CSS mba’ekuaarã tee --bs-navbar-height
térã estilo jeporupyre reheve. Umi jehechaukaha tuichavévape oñembotuichave jave navbar, ojehechaukáta contenido ojehechaháicha peteĩ navbar por defecto-pe.
Eñatendéke ko jepokuaa oúha peteĩ mba’e’apo’ỹ ikatúva reheve overflow
—oñemohenda jave overflow-y: auto
(oñeikotevẽva ojedesplaza hag̃ua contenido ko’ápe), overflow-x
ha’e pe equivalente auto
, oikytĩtava algún contenido horizontal.
Ko’ápe oĩ peteĩ techapyrã navbar oiporúva .navbar-nav-scroll
con style="--bs-scroll-height: 100px;"
, oguerekóva algunas utilidades margen extra espaciado iporãvévape g̃uarã.
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
<a class="navbar-brand" href="#">Navbar scroll</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarScroll" aria-controls="navbarScroll" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarScroll">
<ul class="navbar-nav me-auto my-2 my-lg-0 navbar-nav-scroll" style="--bs-scroll-height: 100px;">
<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 dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarScrollingDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
Link
</a>
<ul class="dropdown-menu" aria-labelledby="navbarScrollingDropdown">
<li><a class="dropdown-item" href="#">Action</a></li>
<li><a class="dropdown-item" href="#">Another action</a></li>
<li><hr class="dropdown-divider"></li>
<li><a class="dropdown-item" href="#">Something else here</a></li>
</ul>
</li>
<li class="nav-item">
<a class="nav-link disabled">Link</a>
</li>
</ul>
<form class="d-flex">
<input class="form-control me-2" type="search" placeholder="Search" aria-label="Search">
<button class="btn btn-outline-success" type="submit">Search</button>
</form>
</div>
</div>
</nav>
Tekokuéra ombohováiva
Umi Navbar ikatu oipuru .navbar-toggler
, .navbar-collapse
, ha .navbar-expand{-sm|-md|-lg|-xl|-xxl}
mbo’esyrykuéra ohechakuaa hag̃ua araka’épa oñehundi ikonteído peteĩ botón rapykuéri. Oñembojoajúvo ambue utilidad ndive, ikatu eiporavo pyaꞌete arakaꞌepa rehechauka térã emokañy umi elemento particular.
Umi navbar araka’eve noñehundírivape g̃uarã, emoĩ pe .navbar-expand
mbo’esyry navbar-pe. Umi navbar akóinte oñembyaívape g̃uarã, ani remoĩ mba’eveichagua .navbar-expand
mbo’esyry.
Toggler rehegua
Umi togglers Navbar-pegua oñemohenda izquierda-pe por defecto, ha katu osegíramo peteĩ elemento hermano-icha peteĩ .navbar-brand
, oñembojoajúta ijeheguiete akatúa gotyo. Embojere nde marcado ombojere jeýta pe toggler ñemohenda. Aguĩve oĩ techapyrã opaichagua estilo de toggle rehegua.
Ndojehechaukái .navbar-brand
reheve pe punto de ruptura michĩvévape:
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarTogglerDemo01" aria-controls="navbarTogglerDemo01" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarTogglerDemo01">
<a class="navbar-brand" href="#">Hidden brand</a>
<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>
</ul>
<form class="d-flex">
<input class="form-control me-2" type="search" placeholder="Search" aria-label="Search">
<button class="btn btn-outline-success" type="submit">Search</button>
</form>
</div>
</div>
</nav>
Peteĩ marca réra ojehechaukáva ijasu gotyo ha toggler akatúa gotyo:
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
<a class="navbar-brand" href="#">Navbar</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarTogglerDemo02" aria-controls="navbarTogglerDemo02" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarTogglerDemo02">
<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>
</ul>
<form class="d-flex">
<input class="form-control me-2" type="search" placeholder="Search" aria-label="Search">
<button class="btn btn-outline-success" type="submit">Search</button>
</form>
</div>
</div>
</nav>
Peteĩ toggler reheve ijasu gotyo ha marca réra akatúape:
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarTogglerDemo03" aria-controls="navbarTogglerDemo03" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#">Navbar</a>
<div class="collapse navbar-collapse" id="navbarTogglerDemo03">
<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>
</ul>
<form class="d-flex">
<input class="form-control me-2" type="search" placeholder="Search" aria-label="Search">
<button class="btn btn-outline-success" type="submit">Search</button>
</form>
</div>
</div>
</nav>
Contenido externo rehegua
Sapy’ánte eipuruse pe plugin de collapso emoñepyrũ hag̃ua peteĩ elemento contenedor rehegua contenido oguapýva estructuralmente okápe .navbar
. Ore plugin omba’apo rupi pe id
ha data-bs-target
joaju rehe, upéva ojejapo ndahasýi!
<div class="collapse" id="navbarToggleExternalContent">
<div class="bg-dark p-4">
<h5 class="text-white h4">Collapsed content</h5>
<span class="text-muted">Toggleable via the navbar brand.</span>
</div>
</div>
<nav class="navbar navbar-dark bg-dark">
<div class="container-fluid">
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarToggleExternalContent" aria-controls="navbarToggleExternalContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
</div>
</nav>
Kóva rejapo jave, romomarandu emoĩ hag̃ua JavaScript ambuéva emongu’e hag̃ua enfoque programáticamente mba’yrúpe ojepe’ávo. Nda’upéichairamo, umi teclado puruhára ha umi tecnología pytyvõhára oipurúva oiméne hasýta ojuhúvo contenido ojekuaa pyahúva - particularmente pe contenedor ojeipe’ava’ekue oúramo toggler mboyve kuatia estructura-pe. Avei romomarandu eñangareko hag̃ua toggler oguerekoha aria-controls
atributo, ohechaukáva pe id
mbaꞌeryru contenido rehegua. Teoría-pe, kóva oheja umi tecnología pytyvõhára puruhárape osaltávo directamente pe toggler-gui pe contenedor ha’e ocontrolávape–ha katu pytyvõ kóvape g̃uarã ko’áĝaite ha’e peteĩ parcheiterei.
Fuera de lona rehegua
Emoambue nde navbar oñembotuicháva ha oñemboguejýva peteĩ cajón offcanvas-pe pe plugin offcanvas reheve. Rombohape mokõive estilo por defecto offcanvas ha roipuru ore .navbar-expand-*
mbo’esyrykuéra romoheñói hag̃ua peteĩ barra lateral navegación dinámica ha flexible.
Pe techapyrã iguýpe, ojejapo hag̃ua peteĩ navbar offcanvas akóinte oñembotyvaꞌekue opaite punto de ruptura rupi, ojeheja rei pe .navbar-expand-*
mboꞌepypaite.
<nav class="navbar navbar-light bg-light fixed-top">
<div class="container-fluid">
<a class="navbar-brand" href="#">Offcanvas navbar</a>
<button class="navbar-toggler" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasNavbar" aria-controls="offcanvasNavbar">
<span class="navbar-toggler-icon"></span>
</button>
<div class="offcanvas offcanvas-end" tabindex="-1" id="offcanvasNavbar" aria-labelledby="offcanvasNavbarLabel">
<div class="offcanvas-header">
<h5 class="offcanvas-title" id="offcanvasNavbarLabel">Offcanvas</h5>
<button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
<ul class="navbar-nav justify-content-end flex-grow-1 pe-3">
<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 dropdown">
<a class="nav-link dropdown-toggle" href="#" id="offcanvasNavbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
Dropdown
</a>
<ul class="dropdown-menu" aria-labelledby="offcanvasNavbarDropdown">
<li><a class="dropdown-item" href="#">Action</a></li>
<li><a class="dropdown-item" href="#">Another action</a></li>
<li>
<hr class="dropdown-divider">
</li>
<li><a class="dropdown-item" href="#">Something else here</a></li>
</ul>
</li>
</ul>
<form class="d-flex">
<input class="form-control me-2" type="search" placeholder="Search" aria-label="Search">
<button class="btn btn-outline-success" type="submit">Search</button>
</form>
</div>
</div>
</div>
</nav>
Ojejapo hag̃ua peteĩ navbar offcanvas oñembotuicháva peteĩ navbar normal-pe peteĩ punto de ruptura específico-pe haꞌeháicha lg
, eipuru .navbar-expand-lg
.
<nav class="navbar navbar-light navbar-expand-lg bg-light fixed-top">
<a class="navbar-brand" href="#">Offcanvas navbar</a>
<button class="navbar-toggler" type="button" data-bs-toggle="offcanvas" data-bs-target="#navbarOffcanvasLg" aria-controls="navbarOffcanvasLg">
<span class="navbar-toggler-icon"></span>
</button>
<div class="offcanvas offcanvas-end" tabindex="-1" id="navbarOffcanvasLg" aria-labelledby="navbarOffcanvasLgLabel">
...
</div>
</nav>
Sass rehegua
Variables rehegua
$navbar-padding-y: $spacer * .5;
$navbar-padding-x: null;
$navbar-nav-link-padding-x: .5rem;
$navbar-brand-font-size: $font-size-lg;
// Compute the navbar-brand padding-y so the navbar-brand will have the same height as navbar-text and nav-link
$nav-link-height: $font-size-base * $line-height-base + $nav-link-padding-y * 2;
$navbar-brand-height: $navbar-brand-font-size * $line-height-base;
$navbar-brand-padding-y: ($nav-link-height - $navbar-brand-height) * .5;
$navbar-brand-margin-end: 1rem;
$navbar-toggler-padding-y: .25rem;
$navbar-toggler-padding-x: .75rem;
$navbar-toggler-font-size: $font-size-lg;
$navbar-toggler-border-radius: $btn-border-radius;
$navbar-toggler-focus-width: $btn-focus-width;
$navbar-toggler-transition: box-shadow .15s ease-in-out;
$navbar-dark-color: rgba($white, .55);
$navbar-dark-hover-color: rgba($white, .75);
$navbar-dark-active-color: $white;
$navbar-dark-disabled-color: rgba($white, .25);
$navbar-dark-toggler-icon-bg: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke='#{$navbar-dark-color}' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg>");
$navbar-dark-toggler-border-color: rgba($white, .1);
$navbar-light-color: rgba($black, .55);
$navbar-light-hover-color: rgba($black, .7);
$navbar-light-active-color: rgba($black, .9);
$navbar-light-disabled-color: rgba($black, .3);
$navbar-light-toggler-icon-bg: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke='#{$navbar-light-color}' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg>");
$navbar-light-toggler-border-color: rgba($black, .1);
$navbar-light-brand-color: $navbar-light-active-color;
$navbar-light-brand-hover-color: $navbar-light-active-color;
$navbar-dark-brand-color: $navbar-dark-active-color;
$navbar-dark-brand-hover-color: $navbar-dark-active-color;
Sã
Umi clase expand/collapse navbar ombohováiva (techapyrã, .navbar-expand-lg
) oñembojoaju $breakpoints
mapa ndive ha oñegenera peteĩ bucle rupive scss/_navbar.scss
.
// Generate series of `.navbar-expand-*` responsive classes for configuring
// where your navbar collapses.
.navbar-expand {
@each $breakpoint in map-keys($grid-breakpoints) {
$next: breakpoint-next($breakpoint, $grid-breakpoints);
$infix: breakpoint-infix($next, $grid-breakpoints);
// stylelint-disable-next-line scss/selector-no-union-class-name
&#{$infix} {
@include media-breakpoint-up($next) {
flex-wrap: nowrap;
justify-content: flex-start;
.navbar-nav {
flex-direction: row;
.dropdown-menu {
position: absolute;
}
.nav-link {
padding-right: $navbar-nav-link-padding-x;
padding-left: $navbar-nav-link-padding-x;
}
}
.navbar-nav-scroll {
overflow: visible;
}
.navbar-collapse {
display: flex !important; // stylelint-disable-line declaration-no-important
flex-basis: auto;
}
.navbar-toggler {
display: none;
}
.offcanvas-header {
display: none;
}
.offcanvas {
position: inherit;
bottom: 0;
z-index: 1000;
flex-grow: 1;
visibility: visible !important; // stylelint-disable-line declaration-no-important
background-color: transparent;
border-right: 0;
border-left: 0;
@include transition(none);
transform: none;
}
.offcanvas-top,
.offcanvas-bottom {
height: auto;
border-top: 0;
border-bottom: 0;
}
.offcanvas-body {
display: flex;
flex-grow: 0;
padding: 0;
overflow-y: visible;
}
}
}
}
}