Dokumentasi lan conto kanggo header navigasi Bootstrap sing kuat, responsif, navbar. Kalebu dhukungan kanggo branding, navigasi, lan liya-liyane, kalebu dhukungan kanggo plugin ambruk kita.
Cara kerjane
Mangkene sampeyan kudu ngerti sadurunge miwiti navbar:
Navbars mbutuhake mbungkus .navbarkaro .navbar-expand{-sm|-md|-lg|-xl}kanggo responsif collapsing lan kelas skema werna .
Navbars lan isine minangka standar. Gunakake wadhah opsional kanggo mbatesi ambane horisontal.
Navbars responsif minangka standar, nanging sampeyan bisa kanthi gampang ngowahi kanggo ngganti. Prilaku responsif gumantung marang plugin Collapse JavaScript.
Navbars didhelikake minangka standar nalika nyetak. Meksa supaya dicithak kanthi nambahake .d-printmenyang .navbar. Deleng kelas sarana tampilan .
Mesthekake aksesibilitas kanthi nggunakake <nav>unsur utawa, yen nggunakake unsur sing luwih umum kayata <div>, tambahake a role="navigation"kanggo saben navbar kanggo ngenali kanthi jelas minangka wilayah landmark kanggo pangguna teknologi assistive.
.navbar-textkanggo nambah strings vertikal tengah teks.
.collapse.navbar-collapsekanggo klompok lan ndhelikake isi navbar dening breakpoint tiyang sepah.
Punika conto kabeh sub-komponen sing kalebu ing navbar tema cahya responsif sing kanthi otomatis ambruk ing lgbreakpoint (gedhe).
Conto iki nggunakake werna ( bg-light) lan spasi ( my-2, my-lg-0, mr-sm-0, my-sm-0) kelas sarana.
Merk
.navbar-brandBisa ditrapake kanggo umume unsur, nanging jangkar paling apik amarga sawetara unsur mbutuhake kelas utilitas utawa gaya khusus .
Nambahake gambar ing gambar .navbar-brandkasebut mesthi mbutuhake gaya khusus utawa keperluan kanggo ukuran sing bener. Kene sawetara conto kanggo nduduhake.
Nav
Navbar navigation links build on our .nav options with their own modifier class and require the use of toggler classes for proper responsive styling. Navigation in navbars will also grow to occupy as much horizontal space as possible to keep your navbar contents securely aligned.
Active states—with .active—to indicate the current page can be applied directly to .nav-links or their immediate parent .nav-items.
And because we use classes for our navs, you can avoid the list-based approach entirely if you like.
You may also utilize dropdowns in your navbar nav. Dropdown menus require a wrapping element for positioning, so be sure to use separate and nested elements for .nav-item and .nav-link as shown below.
Forms
Place various form controls and components within a navbar with .form-inline.
Immediate children elements in .navbar use flex layout and will default to justify-content: between. Use additional flex utilities as needed to adjust this behavior.
Input groups work, too:
Various buttons are supported as part of these navbar forms, too. This is also a great reminder that vertical alignment utilities can be used to align different sized elements.
Text
Navbars may contain bits of text with the help of .navbar-text. This class adjusts vertical alignment and horizontal spacing for strings of text.
Mix and match with other components and utilities as needed.
Color schemes
Theming the navbar has never been easier thanks to the combination of theming classes and background-color utilities. Choose from .navbar-light for use with light background colors, or .navbar-dark for dark background colors. Then, customize with .bg-* utilities.
Containers
Although it’s not required, you can wrap a navbar in a .container to center it on a page or add one within to only center the contents of a fixed or static top navbar.
When the container is within your navbar, its horizontal padding is removed at breakpoints lower than your specified .navbar-expand{-sm|-md|-lg|-xl} class. This ensures we’re not doubling up on padding unnecessarily on lower viewports when your navbar is collapsed.
Placement
Use our position utilities to place navbars in non-static positions. Choose from fixed to the top, fixed to the bottom, or stickied to the top (scrolls with the page until it reaches the top, then stays there). Fixed navbars use position: fixed, meaning they’re pulled from the normal flow of the DOM and may require custom CSS (e.g., padding-top on the <body>) to prevent overlap with other elements.
Navbars can utilize .navbar-toggler, .navbar-collapse, and .navbar-expand{-sm|-md|-lg|-xl} classes to change when their content collapses behind a button. In combination with other utilities, you can easily choose when to show or hide particular elements.
For navbars that never collapse, add the .navbar-expand class on the navbar. For navbars that always collapse, don’t add any .navbar-expand class.
Toggler
Navbar togglers are left-aligned by default, but should they follow a sibling element like a .navbar-brand, they’ll automatically be aligned to the far right. Reversing your markup will reverse the placement of the toggler. Below are examples of different toggle styles.
With no .navbar-brand shown in lowest breakpoint:
With a brand name shown on the left and toggler on the right:
With a toggler on the left and brand name on the right:
External content
Kadhangkala sampeyan pengin nggunakake plugin ambruk kanggo micu konten sing didhelikake ing papan liya ing kaca kasebut. Amarga kita plugin dianggo ing idlan data-targetcocog, sing gampang rampung!