Izingxenye

Inqwaba yezingxenye ezisebenziseka kabusha zakhelwe ku-Bootstrap ukuze inikeze ukuzulazula, izexwayiso, ama-popovers, nokunye okuningi.

Amaqembu ezinkinobho

Sebenzisa amaqembu ezinkinobho ukuze uhlanganise izinkinobho eziningi njengengxenye eyodwa eyinhlanganisela. Zakhele ngochungechunge <a>noma<button> izakhi.

Imikhuba emihle kakhulu

Sincoma imihlahlandlela elandelayo yokusebenzisa amaqembu ezinkinobho namabha wamathuluzi:

  • Sebenzisa njalo into efanayo eqenjini lenkinobho eyodwa, <a>noma<button> .
  • Ungahlanganisi izinkinobho zemibala ehlukene eqenjini lezinkinobho ezifanayo.
  • Sebenzisa izithonjana ngaphezu noma esikhundleni sombhalo, kodwa qiniseka ukuthi uhlanganisa i-alt nombhalo wesihloko lapho kufanele khona.

Amaqembu Ezinkinobho Ezihlobene anokwehliswayo (bona ngezansi) kufanele abizwe ngokuhlukana futhi afake njalo ukunakekelwa kokwehla ukuze abonise ukuziphatha okuhlosiwe.

Isibonelo esizenzakalelayo

Nansi indlela i-HTML ebheka ngayo iqembu lezinkinobho ezijwayelekile elakhiwe ngezinkinobho zamathegi wehange:

  1. <div class = "btn-group" >
  2. <inkinobho yekilasi = "btn" > 1 </inkinobho>
  3. <inkinobho yekilasi = "btn" > 2 </inkinobho>
  4. <inkinobho yekilasi = "btn" > 3 </inkinobho>
  5. </div>

Isibonelo sebha yamathuluzi

Hlanganisa amasethi we <div class="btn-group">-a <div class="btn-toolbar">ukuze uthole izingxenye eziyinkimbinkimbi.

  1. <div class = "btn-toolbar" >
  2. <div class = "btn-group" >
  3. ...
  4. </div>
  5. </div>

Ibhokisi lokuhlola nama-flavour omsakazo

Amaqembu ezinkinobho angaphinda asebenze njengemisakazo, lapho inkinobho eyodwa kuphela engase isebenze, noma amabhokisi okuhlola, lapho noma iyiphi inombolo yezinkinobho ingase isebenze. Buka amadokhumenti e-Javascript alokho .

Thola i-javascript »

Okwehliswayo emaqenjini ezinkinobho

Amakhanda phezulu! Izinkinobho ezinokwehliswayo kufanele zisongwe ngazodwa .btn-groupngaphakathi kwe-a .btn-toolbarukuze zinikezwe okulungile.

Ukwehliswa kwezinkinobho

Uhlolojikelele nezibonelo

Sebenzisa noma iyiphi inkinobho ukuze uqalise imenyu eyehlayo ngokuyibeka ngaphakathi .btn-groupfuthi unikeze umaki wemenyu ofanele.

Imakhaphu yesibonelo

Ngokufanayo neqembu lezinkinobho, umaki wethu usebenzisa umaka wezinkinobho ezivamile, kodwa ngedlanzana lezengezo ukuze ucwenge isitayela futhi usekele i-plugin ye-jQuery eyehlayo ye-Bootstrap.

  1. <div class = "btn-group" >
  2. <a class = "btn dropdown-toggle" data-toggle = "dropdown" href = "#" >
  3. Isenzo
  4. <span class = "caret" ></span>
  5. </a>
  6. <ul class = "imenyu eyehlayo" >
  7. <!-- izixhumanisi zemenyu eyehlayo -->
  8. </ul>
  9. </div>

Isebenza nabo bonke osayizi bezinkinobho

Okwehliswayo kwezinkinobho kusebenza kunoma imuphi usayizi. inkinobho yakho osayizi ukuze .btn-large, .btn-small, noma .btn-mini.

Idinga i-javascript

Ukwehliswa kwezinkinobho kudinga i- plugin eyehlayo ye-Bootstrap ukuthi isebenze.

Kwezinye izimo—njengamamenyu okwehlayo eselula azonwebeka ngaphandle kwendawo yokubuka. Udinga ukuxazulula ukuqondanisa ngesandla noma nge-javascript yangokwezifiso.


Okwehliswayo kwenkinobho yokuhlukanisa

Uhlolojikelele nezibonelo

Ukwakhela phezu kwezitayela zeqembu lezinkinobho kanye nemakhaphu, singakha kalula inkinobho yokuhlukanisa. Izinkinobho zokuhlukanisa zifaka isenzo esijwayelekile kwesokunxele kanye nokuguqula okwehlayo kwesokudla ngezixhumanisi zomongo.

Osayizi

Sebenzisa amakilasi enkinobho eyengeziwe .btn-mini, .btn-small, noma .btn-largeukwenza usayizi.

  1. <div class = "btn-group" >
  2. ...
  3. <ul class = "imenyu eyehlayo donsa-kwesokudla" >
  4. <!-- izixhumanisi zemenyu eyehlayo -->
  5. </ul>
  6. </div>

Imakhaphu yesibonelo

Sinweba kokwehliswayo kwenkinobho evamile ukuze sinikeze isenzo senkinobho yesibili esebenza njengesicuphi esihlukile sokwehlisa.

  1. <div class = "btn-group" >
  2. <inkinobho yekilasi = "btn" > Isenzo </inkinobho>
  3. <button class = "btn dropdown-toggle" data-toggle = "dropdown" >
  4. <span class = "caret" ></span>
  5. </inkinobho>
  6. <ul class = "imenyu eyehlayo" >
  7. <!-- izixhumanisi zemenyu eyehlayo -->
  8. </ul>
  9. </div>

Amamenyu okwehlisa

Amamenyu okudonsela phansi nawo angashintshwa kusukela phansi kuye phezulu ngokwengeza iklasi elilodwa kumzali oseduze we- .dropdown-menu. Izophenya isiqondiso se .caretbese ibeka kabusha imenyu ngokwayo ukuze isuke phansi iye phezulu esikhundleni sokusuka phezulu iye phansi.

  1. <div class = "i-btn-group dropup" >
  2. <inkinobho yekilasi = "btn" > Drop </inkinobho>
  3. <button class = "btn dropdown-toggle" data-toggle = "dropdown" >
  4. <span class = "caret" ></span>
  5. </inkinobho>
  6. <ul class = "imenyu eyehlayo" >
  7. <!-- izixhumanisi zemenyu eyehlayo -->
  8. </ul>
  9. </div>

Ukuhlanganisa amakhasi amaningi

Isetshenziswa nini

Ukwakheka kwamakhasi okunesitayela esilula kakhulu nokunesitayela esincane okukhuthazwe yi-Rdio, kulungele izinhlelo zokusebenza nemiphumela yosesho. Ibhulokhi enkulu kunzima ukuyigeja, ingakala kalula, futhi ihlinzeka ngezindawo ezinkulu zokuchofoza.

Izixhumanisi zekhasi ezisemthethweni

Izixhumanisi zingenziwa ngendlela oyifisayo futhi zisebenza ezimeni eziningi ngesigaba esifanele. .disabledngezixhumanisi ezingachofozwayo kanye .activenekhasi lamanje.

Ukuqondanisa okuvumelana nezimo

Engeza noma yiliphi kwezigaba ezimbili ozikhethela ukuze uguqule ukuqondanisa kwezixhumanisi zamakhasi: .pagination-centeredkanye .pagination-right.

Izibonelo

Ingxenye yokubhala ezenzakalelayo iyavumelana nezimo futhi isebenza ngenani lokuhlukahluka.

Imakhaphu

Isongwe nge- <div>, ukuqanjwa kumane nje kuyi- <ul>.

  1. <div class = "pagination" >
  2. <ul>
  3. <li><a href = "#" > Okwedlule </a></li>
  4. <li class = "active" >
  5. <a href = "#" > 1 </a>
  6. </li>
  7. <li><a href = "#" > 2 </a></li>
  8. <li><a href = "#" > 3 </a></li>
  9. <li><a href = "#" > 4 ​​</a></li>
  10. <li><a href = "#" > Okulandelayo </a></li>
  11. </ul>
  12. </div>

I- Pager Ukuze uthole izixhumanisi ezisheshayo ezedlule nezilandelayo

Mayelana nepheyija

Ingxenye yepheyija isethi yezixhumanisi zokusetshenziswa okulula kokwenza amaqebelengwane okunophawu olukhanyayo kanye nezitayela ezilula nakakhulu. Ilungele amasayithi alula njengamabhulogi noma omagazini.

Isimo sokukhubazeka ongakukhetha

Izixhumanisi zama-pager nazo zisebenzisa .disabledisigaba esijwayelekile esivela ku-pagination.

Isibonelo esizenzakalelayo

Ngokuzenzakalela, izixhumanisi ze-pager.

  1. <ul class = "pager" >
  2. <li>
  3. <a href = "#" > Okwedlule </a>
  4. </li>
  5. <li>
  6. <a href = "#" > Okulandelayo </a>
  7. </li>
  8. </ul>

Izixhumanisi eziqondanisiwe

Kungenjalo, ungakwazi ukuqondanisa isixhumanisi ngasinye emaceleni:

  1. <ul class = "pager" >
  2. <li class = "previous" >
  3. <a href = "#" > Okudadlana </a>
  4. </li>
  5. <li class = "okulandelayo" >
  6. <a href = "#" > Okusha → </a>
  7. </li>
  8. </ul>
Amalebula Imakhaphu
Okuzenzakalelayo <span class="label">Default</span>
Impumelelo <span class="label label-success">Success</span>
Isexwayiso <span class="label label-warning">Warning</span>
Okubalulekile <span class="label label-important">Important</span>
Ulwazi <span class="label label-info">Info</span>
Okuphambene <span class="label label-inverse">Inverse</span>

Mayelana

Amabheji amancane, izingxenye ezilula zokubonisa inkomba noma ukubala kohlobo oluthile. Avame ukutholakala kumaklayenti e-imeyili afana ne-Mail.app noma kuzinhlelo zokusebenza zeselula ukuze uthole izaziso zohlelo lokusebenza.

Amakilasi atholakalayo

Igama Isibonelo Imakhaphu
Okuzenzakalelayo 1 <span class="badge">1</span>
Impumelelo 2 <span class="badge badge-success">2</span>
Isexwayiso 4 <span class="badge badge-warning">4</span>
Okubalulekile 6 <span class="badge badge-important">6</span>
Ulwazi 8 <span class="badge badge-info">8</span>
Okuphambene 10 <span class="badge badge-inverse">10</span>

Iqembu lamaqhawe

I-Bootstrap inikeza ingxenye engasindi, eguquguqukayo ebizwa ngokuthi iyunithi yeqhawe ukuze ibonise okuqukethwe kusayithi lakho. Isebenza kahle ekukhangiseni nakumasayithi anesisindo sokuqukethwe.

Imakhaphu

Gcwalisa okuqukethwe kwakho ngendlela divefana nalena:

  1. <div class = "hero-unit" >
  2. <h1> Isihloko </h1>
  3. <p> Ulayini wethegi </p>
  4. <p>
  5. <a class = "btn btn-primary btn-large" >
  6. Funda kabanzi
  7. </a>
  8. </p>
  9. </div>

Sawubona Mhlaba!

Leli iyunithi yeqhawe elilula, ingxenye elula yesitayela se-jumbotron yokubiza ukunaka okwengeziwe kokuqukethwe okufakiwe noma ulwazi.

Funda kabanzi

Unhlokweni wekhasi

Igobolondo elilula h1lendawo yokukhipha ngokufanelekile futhi uhlukanise izingxenye zokuqukethwe ekhasini. Ingasebenzisa h1okumisiwe small, ingxenye kanye nezinye izingxenye eziningi (ngezitayela ezengeziwe).

  1. <div class = "isihloko sekhasi" >
  2. <h1> Iheda yekhasi eliyisibonelo </h1>
  3. </div>

Izithonjana ezizenzakalelayo

Ngokuzenzakalelayo, izithonjana ze-Bootstrap ziklanyelwe ukubonisa izithombe ezixhunyiwe ezinomakhaphu omncane odingekayo.

Yenza ngokwezifiso kakhulu

Ngophawu oluthe xaxa, ungakwazi ukwengeza noma yiluphi uhlobo lokuqukethwe kwe-HTML njengezihloko, izigaba, noma izinkinobho ezithonjaneni.

  • Ilebula yesithonjana

    Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.

    Isenzo Isenzo

  • Ilebula yesithonjana

    Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.

    Isenzo Isenzo

Kungani usebenzise izithonjana

Izithonjana (ngaphambilini .media-gridkuze kufike ku-v1.4) zinhle kumagridi ezithombe noma amavidiyo, imiphumela yosesho lwezithombe, imikhiqizo yokudayisa, amaphothifoliyo, nokunye okuningi. Kungaba izixhumanisi noma okuqukethwe okumile.

Imakhaphu elula, evumelana nezimo

Umaki wezithonjana ulula—okunanoma uliyiphi inombolo liyezinto yikho kuphela okudingekayo. Futhi iguquguquka kakhulu, ivumela noma iluphi uhlobo lokuqukethwe olunomakhaphu owengeziwe wokugoqa okuqukethwe kwakho.

Isebenzisa osayizi bekholomu yegridi

Okokugcina, ingxenye yezithonjana isebenzisa amakilasi esistimu yegridi ekhona—njengenoma— .span2ukulawula .span3ubukhulu bezithonjana.

Imakhaphu

Njengoba kushiwo ngaphambili, umaka odingekayo wezithonjana ulula futhi uqondile. Nakhu ukubheka ukusethwa okuzenzakalelayo kwezithombe ezixhunyiwe :

  1. <ul class = "izithonjana" >
  2. <li class = "span3" >
  3. <a href = "#" class = "isithonjana" >
  4. <img src = "https://placehold.it/260x180" alt = "" >
  5. </a>
  6. </li>
  7. ...
  8. </ul>

Ngokuqukethwe kwe-HTML yangokwezifiso ezithonjaneni, umaki uyashintsha kancane. Ukuvumela okuqukethwe kweleveli yebhulokhi noma yikuphi, sishintshanisa <a>okufana <div>nalokhu:

  1. <ul class = "izithonjana" >
  2. <li class = "span3" >
  3. <div class = "isithonjana" >
  4. <img src = "https://placehold.it/260x180" alt = "" >
  5. <h5> Ilebula yesithonjana </h5>
  6. <p> Amazwibela esithonjana khona lapha... </p>
  7. </div>
  8. </li>
  9. ...
  10. </ul>

Izibonelo ezengeziwe

Hlola zonke izinketho zakho ngamakilasi egridi ahlukahlukene atholakalayo kuwe. Ungaphinda uhlanganise futhi ufanise osayizi abahlukahlukene.

Okuzenzakalelayo okungasindi

Isigaba sesisekelo esibhalwe kabusha

Nge-Bootstrap 2, senze isigaba sesisekelo saba lula: .alertesikhundleni se- .alert-message. Siphinde sehlise ubuncane bemakhaphu obudingekayo—cha <p>iyadingeka ngokuzenzakalelayo, ngaphandle nje<div> .

Umlayezo owodwa wokwazisa

Ukuze uthole ingxenye ehlala isikhathi eside enekhodi encane, sisuse ukubukeka okuhlukanisayo kwezixwayiso zamabhulokhi, imilayezo eza namaphedi amaningi kanye nombhalo ngokuvamile owengeziwe. Ikilasi nalo selishintshile kwaba .alert-block.


Ihamba kahle nge-javascript

I-Bootstrap iza ne-plugin enhle ye-jQuery esekela imilayezo yesixwayiso, okwenza ukuyixosha ngokushesha futhi kube lula.

Thola i-plugin »

Izexwayiso eziyisibonelo

Goqa umlayezo wakho kanye nesithonjana ongasikhetha sokuvala ku-div ngekilasi elilula.

Isexwayiso! Kungcono uzihlole kahle, awubukeki umuhle kakhulu.
  1. <div class = "isaziso" >
  2. <button class = "close" data-dismiss = "alert" > × </button>
  3. <strong> Isexwayiso! I </strong> Zihlole kahle, awubukeki umuhle kakhulu.
  4. </div>

Amakhanda phezulu! Amadivayisi we-iOS adinga href="#"ukuchithwa kwezixwayiso. Qiniseka ukuthi uyayifaka kanye nesibaluli sedatha sezithonjana zokuvala ihange. Kungenjalo, ungasebenzisa i- <button>elementi enesibaluli sedatha, esikhethe ukuyenzela amadokhumenti ethu. Uma usebenzisa <button>, kufanele ufake type="button"noma amafomu akho angase angawahambisi.

Nweba kalula umlayezo ojwayelekile wesexwayiso ngamakilasi amabili ongawakhetha: .alert-blockukuze uthole izilawuli eziningi zokupheda nombhalo kanye .alert-headingnesihloko esifanayo.

Isexwayiso!

Kungcono uzihlole kahle, awubukeki umuhle kakhulu. I-Nulla vitae elit libero, i-pharetra augue. I-Preesent commodo cursus magna, vel scelerisque nisl consectetur et.

  1. <div class = "i-alert-block-block" >
  2. <a class = "close" data-dismiss = "alert" href = "#" > × </a>
  3. <h4 class = "alert-heading" > Isexwayiso! </h4>
  4. Okungcono uzihlole wena, awu...
  5. </div>

Ezinye izindlela zokuqukethwe Engeza amakilasi ongawakhetha ukuze uguqule incazelo yesexwayiso

Iphutha noma ingozi

Hawu! Shintsha izinto ezimbalwa bese uzama ukuthumela futhi.
  1. <div class = "iphutha lesaziso" >
  2. ...
  3. </div>

Impumelelo

Wenze kahle! Ufunde ngempumelelo lo mlayezo obalulekile wesexwayiso.
  1. <div class = "impumelelo yesixwayiso" >
  2. ...
  3. </div>

Ulwazi

Amakhanda phezulu! Lesi sexwayiso sidinga ukunakwa kwakho, kodwa asibalulekile kakhulu.
  1. <div class = "ulwazi lwesixwayiso" >
  2. ...
  3. </div>

Izibonelo kanye nemakhaphu

Okuyisisekelo

Ibha yokuqhubeka ezenzakalelayo enegradient eqondile.

  1. <div class = "progress" >
  2. <div class = "ibha"
  3. isitayela = " ububanzi : 60 %; " ></div>
  4. </div>

Inemithende

Isebenzisa i-gradient ukudala umphumela onemigqa (akukho IE).

  1. <div class = "progress progress-striped" >
  2. <div class = "ibha"
  3. isitayela = " ububanzi : 20 %; " ></div>
  4. </div>

Okugqwayizayo

Ithatha isibonelo esinemigqa bese isenza (akukho IE).

  1. <div class = "inqubekelaphambili enemigqa
  2. iyasebenza" >
  3. <div class = "ibha"
  4. isitayela = " ububanzi : 40 %; " ></div>
  5. </div>

Izinketho nokusekelwa kwesiphequluli

Imibala eyengeziwe

Amabha okuqhubeka asebenzisa inkinobho efanayo namakilasi okuxwayisa ngezitayela ezingaguquki.

Imigoqo enemigqa

Ngokufana nemibala eqinile, sinemigoqo yenqubekelaphambili enemigqa ehlukahlukene.

Ukuziphatha

Amabha okuqhubeka asebenzisa ukuguqulwa kwe-CSS3, ngakho-ke uma ulungisa ububanzi nge-javascript, izoshintsha usayizi ngokushelelayo.

Uma usebenzisa .activeikilasi, .progress-stripedimigoqo yakho yokuqhubeka izophila imithende ukusuka kwesokunxele kuye kwesokudla.

Usekelo lwesiphequluli

Amabha wenqubekelaphambili asebenzisa ama-gradient e-CSS3, ukuguqulwa, nokugqwayiza ukuze kuzuzwe yonke imiphumela yakhona. Lezi zici azisekelwa kuzinguqulo ze-IE7-9 noma ezindala zeFirefox.

I-Opera ne-IE azisekeli ukugqwayiza ngalesi sikhathi.

Imithombo

Sebenzisa umthombo njengomphumela olula ku-elementi ukuze uyinikeze umphumela wokufakwayo.

Bheka, ngisemthonjeni!
  1. <div class = "kahle" >
  2. ...
  3. </div>

Vala isithonjana

Sebenzisa isithonjana sokuvala esijwayelekile ukuze uchithe okuqukethwe okufana namamodeli nezixwayiso.

  1. <inkinobho yekilasi = "vala" > &izikhathi; </inkinobho>

Amadivayisi we-iOS adinga i- href="#" yokuchofoza imicimbi uma ukhetha ukusebenzisa ihange.

  1. <a class = "close" href = "#" > &izikhathi; </a>