Sɛbɛnw ni misaliw Bootstrap ka navigatiɔn kuncɛ barikama, min bɛ jaabi di, n’o ye navbar ye. Dɛmɛ bɛ sɔrɔ a kɔnɔ, ka ɲɛsin taamasiyɛnw ma, navigatiɔnw, ani fɛn wɛrɛw ma, o la, dɛmɛ don an ka collapse plugin ma.
A bɛ baara kɛ cogo min na
Aw ka kan ka fɛn minnu dɔn sani aw ka navbar daminɛ, olu filɛ nin ye:
Navbars bɛ ɲini wrapping .navbarni .navbar-expand{-sm|-md|-lg|-xl}for responsive collapsing ani color scheme classes.
Navbarw n’u kɔnɔkow ye ji ye ka da a kan. Aw bɛ baara kɛ ni minɛnw ye minnu bɛ se ka kɛ walasa ka dan sigi u bonya tilennen na.
Baara kɛ ni an ka spacing ani flex utility classes ye walasa ka spacing ni alignment kɔlɔsi navbars kɔnɔ.
Navbarw bɛ jaabi di ka da a kan, nka i bɛ se k’u ladilan nɔgɔya la walasa k’o Changer. Jaabi kɛcogo bɛ bɔ an ka Collapse JavaScript plugin de la.
Navbarw bɛ dogo ka kɛɲɛ ni u yɛrɛ ye ni u bɛ sɛbɛnni kɛ. Wajibiya u ka sɛbɛn ni farali .d-printye .navbar. Aw ye jiracogo nafama kalasi lajɛ.
Aw ye aw janto sɔrɔli la ni baara kɛli ye ni <nav>fɛn dɔ ye walima ni aw bɛ baara kɛ ni fɛn dɔ ye min ka ca ni fɛn bɛɛ ye i n’a fɔ a <div>, aw bɛ a fara role="navigation"navbar bɛɛ kan walasa k’a jira k’a jɛya ko a ye mara taamasiyɛn ye dɛmɛnan fɛɛrɛw baarakɛlaw bolo.
Aw ye kalan kɛ ka taa ɲɛ walasa ka misali dɔ sɔrɔ ani yɔrɔ fitinin minnu bɛ dɛmɛ sɔrɔ, olu lisɛli.
Kɔnɔkow minnu bɛ dɛmɛ
Navbarw bɛ na ni dɛmɛni ye min bɛ don a kɔnɔ ka ɲɛsin bolomafara fitinin dɔw ma. Aw bɛ ninnu sugandi ni aw mago bɛ a la:
.navbar-brandka ɲɛsin i ka sosiyete, i ka fɛn dilannen, walima i ka porozɛ tɔgɔ ma.
.navbar-navwalasa ka navigatiɔn dafalen ni nɔgɔya sɔrɔ (dɛmɛni fana sen bɛ o la ka ɲɛsin jiginɛw ma).
.navbar-togglerka baara kɛ ni an ka collapse plugin ye ani navigation toggling kɛcogo wɛrɛw.
.form-inlineka ɲɛsin foroko o cogoya kɔlɔsili ni walew ma.
.navbar-textwalasa ka sɛbɛnniw sɛrɛkiliw fara ɲɔgɔn kan minnu bɛ cɛmancɛ jɔlen na.
.collapse.navbar-collapseka navbar kɔnɔkow kulu ni u dogo bangebaga ka kariyɔrɔ dɔ fɛ.
Nin ye misali ye min bɛ yɔrɔ fitininw bɛɛ la minnu bɛ jaabi yeelen-ko-ɲɛnabɔ-navbar kɔnɔ min bɛ bin a yɛrɛma lg(ba) kariyɔrɔ la.
Nin misali in bɛ baara kɛ ni kulɛri ( bg-light) ni yɔrɔjan ( my-2, my-lg-0, mr-sm-0, my-sm-0) nafama kalasiw ye.
Mariki
The .navbar-brandbɛ se ka kɛ fɛn fanba la, nka ankɔri bɛ baara kɛ ka ɲɛ bawo fɛn dɔw bɛ se ka nafalanw walima ladamu cogoyaw de wajibiya.
Jaw farali o kan, a ka c’a la, o .navbar-brandbɛna kɛ sababu ye tuma bɛɛ ka ladamu cogoyaw walima nafamafɛnw kɛ walasa u ka bonya ka ɲɛ. Misali dɔw filɛ nin ye minnu bɛ se ka jira.
Nav
Navbar navigation links bɛ jɔ an ka .navsugandiliw kan n’u yɛrɛ ka modifier class ye ani u bɛ baara kɛ ni toggler classes ye walasa ka jaabi kɛcogo ɲuman sɔrɔ. Navigation in navbars fana bɛna bonya walasa ka yɔrɔ horizontal caman minɛ i n’a fɔ a bɛ se ka kɛ cogo min na walasa i ka navbar kɔnɔkow ka to u cogo la ka ɲɛ.
Active states—ni .active—ka ɲɛ min jira sisan, olu bɛ se ka kɛ ka ɲɛsin .nav-links ma walima u bangebaga gɛrɛfɛ .nav-items ma.
Wa k’a sababu Kɛ an bɛ baara Kɛ ni kalanw ye an ka navs (navs) kama, i bɛ Se k’i yɛrɛ Kɔrɔbɔ list-based approach (list-based approach) la pewu n’i b’a fɛ.
Aw bɛ se fana ka baara kɛ ni fɛnw ye minnu bɛ bɔ aw ka navbar nav kɔnɔ. Meniw minnu bɛ jigin, olu bɛ fɛn dɔ de wajibiya min bɛ kɛ ka fɛnw siri, o la aw ye aw jija ka baara kɛ ni fɛnw ye minnu bɛ danfara la ani minnu bɛ sigi sen kan .nav-itemani .nav-linki n’a fɔ a jiralen bɛ cogo min na jukɔrɔ.
Sɛbɛnw
Aw bɛ foroko kunkankow ni yɔrɔw suguya caman bila navbar kɔnɔ ni .form-inline.
Teliya denmisɛnw elements in .navbaruse flex layout ani bɛna default kɛ justify-content: space-between. Aw bɛ baara kɛ ni flex utilité wɛrɛw ye i n’a fɔ aw mago bɛ cogo min na walasa ka o kɛcogo ladilan.
Donan kuluw bɛ baara kɛ, olu fana:
Butɔn suguya caman bɛ dɛmɛ ka kɛ nin navbar foroko ninnu dɔ ye, olu fana. Nin fana ye hakilijiginba ye ko jɛgɛncogo nafamafɛnw bɛ se ka kɛ ka fɛnw labɛn minnu bonya tɛ kelen ye.
Masalabolo
Navbarw bɛ se ka sɛbɛnni bitikiw sɔrɔ ni dɛmɛ ye .navbar-text. Nin kalan in bɛ ɲɔgɔndan jɔlenw ni janya tilennenw ladilan sɛbɛnniw sɛrɛw kama.
Aw bɛ a ɲagami ka a bɛn ni a yɔrɔ wɛrɛw ni nafamafɛnw ye ni aw mago bɛ a la.
Kulɛriw cogoyaw
Theming the navbar ma deli ka nɔgɔya ka tɛmɛn o kan k’a sababu kɛ theming classes ni background-colorutilities faralen ye ɲɔgɔn kan. Sugandili .navbar-lightkɛ walasa ka baara kɛ ni kɔkanna kulɛri jɛlenw ye, walima ka baara kɛ ni kɔkanna kulɛri .navbar-darkdibimanw ye. O kɔfɛ, i ka customize ni .bg-*utilities ye.
Minɛnw
Hali n’a ma wajibiya, i bɛ se ka navbar dɔ siri a kɔnɔ walasa k’a cɛmancɛ kɛ ɲɛ dɔ kan walima ka dɔ fara a kɔnɔ walasa ka sanfɛla navbar jɔlen walima jɔlen.container kɔnɔkow cɛmancɛ dɔrɔn de kɛ .
Ni minɛn bɛ i ka navbar kɔnɔ, a padding horizontal bɛ bɔ breakpoints (kariyɔrɔw) la minnu ka dɔgɔ ni i ka .navbar-expand{-sm|-md|-lg|-xl}classe kofɔlen ye. O b'a To an tɛ 'yɔrɔ fla Kɛ padding kan kun tɛ min na duguma-jiralanw kan n'i ka navbar (navbar) Dònna.
Yɔrɔ bilali
Baara kɛ ni an ka jɔyɔrɔ nafamafɛnw ye walasa ka navbarw bila jɔyɔrɔw la minnu tɛ jɔ. Sugandili kɛ ka bɔ a jɔlen na ka taa sanfɛ, a jɔlen bɛ duguma, walima a bɛ nɔrɔ sanfɛ (a bɛ sɛbɛn ni ɲɛ ye fo ka se sanfɛ, o kɔfɛ a bɛ to yen). Navbar fixes bɛ baara Kɛ ni position: fixed, kɔrɔ ye k’u bɛ sama ka Bɔ DOM ka normal flow la wa u bɛ Se ka CSS ladamulen wajibiya (misali la, ) padding-topkan <body>walasa ka ɲɔgɔndan bali ni fɛn wɛrɛw ye.
Navbarw bɛ se ka baara kɛ ni .navbar-toggler, .navbar-collapse, ani .navbar-expand{-sm|-md|-lg|-xl}kalanw ye walasa ka fɛn caman Changer ni u kɔnɔkow bɛ bin butɔni dɔ kɔfɛ. Ni i farala nafamafɛn wɛrɛw kan, i bɛ se k’a sugandi nɔgɔya la waati min na i bɛna fɛn kɛrɛnkɛrɛnnenw jira walima k’u dogo.
Navbar minnu tɛ bin abada, aw bɛ .navbar-expandkalasi fara navbar kan. Navbar minnu bɛ bin tuma bɛɛ, aw kana .navbar-expandkalasi si fara a kan.
Toggler ye
Navbar togglers bɛ Labɛn numan fɛ ka da a kan, nka n’u tugura balimakɛ-yɔrɔ dɔ kɔ i n’a fɔ a .navbar-brand, u bɛ Labɛn u yɛrɛma ka Taa kinin fɛ yɔrɔ jan na. Ni i ye i ka taamasiyɛn kɔsegin, o bɛna toggler bilali kɔsegin. Toggle cogoya wɛrɛw misaliw bɛ duguma.
Ni a ma .navbar-brandjira kariyɔrɔ dɔgɔmannin na:
Ni marka tɔgɔ jiralen bɛ kinin fɛ ani toggler bɛ kinin fɛ:
Ni toggler bɛ kinin fɛ ani brand tɔgɔ kinin fɛ:
Kɛnɛyako kɔnɔkow
Tuma dɔw la, i b’a fɛ ka baara kɛ ni collapse plugin ye walasa ka kunnafoni dogolenw daminɛ yɔrɔ wɛrɛ la ɲɛ kan. Komin an ka plugin bɛ baara Kɛ ni idani data-targetmatching ye, o bɛ Kɛ nɔgɔya la!