Intshayelelo
Qalisa ngeBootstrap, esona sikhokelo sidumileyo kwihlabathi sokwakha iisayithi eziphendulayo, eziphathwayo zokuqala, ngejsDelivr kunye nephepha lokuqala letemplate.
Ngaba ujonge ukongeza ngokukhawuleza iBootstrap kwiprojekthi yakho? Sebenzisa i-jsDelivr, ebonelelwe simahla ngabantu base-jsDelivr. Usebenzisa umphathi wepakethe okanye ufuna ukukhuphela iifayile zomthombo? Yiya kwiphepha lokukhuphela.
Khuphela-ncamathisela isitayile <link>
sakho <head>
phambi kwawo onke amanye amaphepha ukuze ulayishe iCSS yethu.
Uninzi lwamacandelo ethu afuna ukusetyenziswa kweJavaScript ukusebenza. Ngokukodwa, zifuna i - jQuery , Popper.js , kunye neeplagi zethu zeJavaScript. Beka oku kulandelayo <script>
kufutshane nesiphelo samaphepha akho, kanye phambi kwethegi yokuvala </body>
, ukuze bakwazi. I-jQuery kufuneka ize kuqala, emva koko i-Popper.js, kunye neeplagi zethu zeJavaScript.
Sisebenzisa i -jQuery's slim build , kodwa inguqulelo epheleleyo nayo iyaxhaswa.
Ngaba ufuna ukwazi ukuba zeziphi izinto ezifuna ngokucacileyo i-jQuery, i-JS yethu, kunye ne-Popper.js? Cofa ikhonkco lamacandelo angezantsi. Ukuba awuqinisekanga kwaphela malunga nesakhiwo sephepha ngokubanzi, qhubeka ufunda umzekelo wetemplate yephepha.
Yethu bootstrap.bundle.js
kwaye bootstrap.bundle.min.js
iquka iPopper , kodwa hayi i - jQuery . Ngolwazi oluthe kratya malunga nokuba kufakwe ntoni kwi-Bootstrap, nceda ubone icandelo lethu leziqulatho .
Bonisa amalungu afuna iJavaScript
- Izaziso zokugxotha
- Amaqhosha okuguqula iimeko kunye nokukhangela ibhokisi/umsebenzi werediyo
- I-Carousel yazo zonke izilayidi zokuziphatha, ulawulo, kunye nezalathi
- Ukugoqa ukuze uguqule ukubonakala komxholo
- Ukwehla kokubonisa kunye nokubeka (ikwafuna iPopper.js )
- Iimodyuli zokubonisa, ukubeka, kunye nokuziphatha kokuskrola
- I-Navbar yokwandisa iplagi yethu yokuLahla ukuze kuphunyezwe indlela yokuziphatha ephendulayo
- Iingcebiso zezixhobo kunye neepopovers zokubonisa kunye nokubeka (ikwafuna iPopper.js )
- I-Scrollspy yokuziphatha kokuskrola kunye nohlaziyo lokukhangela
Qinisekisa ukuba amaphepha akho amiselwe ngoyilo lwamva nje kunye nemigangatho yophuhliso. Oko kuthetha ukusebenzisa i-HTML5 doctype kunye nokubandakanya i-meta tag ye-viewport yeendlela zokuziphatha ezifanelekileyo zokuphendula. Yidibanise yonke kwaye amaphepha akho kufuneka ajongeke ngolu hlobo:
Yiloo nto kuphela oyifunayo kwiimfuno zephepha ngokubanzi. Ndwendwela amaxwebhu oYilo okanye imizekelo yethu esemthethweni ukuqalisa ukubeka umxholo wesayithi yakho kunye nezixhobo.
I-Bootstrap isebenzisa isitayile esibalulekileyo sehlabathi kunye noseto oya kufuneka ukuba ulumkele xa uyisebenzisa, zonke eziphantse zibe zilungiselelwe ngokukodwa ukwenziwa kwesiqhelo kwezitayile zebrawuza . Masingene ngaphakathi.
I-Bootstrap ifuna ukusetyenziswa kwe-HTML5 doctype. Ngaphandle kwayo, uya kubona isitayile esimnandi esingaphelelanga, kodwa ukubandakanya akufuneki kubangele naziphi na iihiccups.
I-Bootstrap iphuhliswa ngeselfowuni kuqala , isicwangciso apho silungiselela ikhowudi yezixhobo eziphathwayo kuqala kwaye emva koko sinyuse amacandelo njengoko kuyimfuneko kusetyenziswa imibuzo yemidiya yeCSS. Ukuqinisekisa unikezelo olululo kunye nokuchukumisa ukusondeza kuzo zonke izixhobo, yongeza i-meta tag ephendulayo kwindawo yakho <head>
.
Ungawubona umzekelo wale nto kwi template yokuqalisa .
Ukufumana ukulinganisa okuthe ngqo kwi-CSS, sitshintsha box-sizing
ixabiso lehlabathi ukusuka content-box
kwi border-box
. Oku kuqinisekisa padding
ukuba abuchaphazeli ububanzi obubaliweyo bokugqibela bento, kodwa kunokubangela iingxaki ngesoftware yomntu wesithathu efana neeMephu zikaGoogle kunye neNjini yokuKhangela kaGoogle.
Ngezihlandlo ezinqabileyo kufuneka uyihoxise, sebenzisa into efana nale ilandelayo:
Ngolu lwazi lungasentla, izinto ezibekwe kwindlwane-kuquka umxholo owenziweyo nge ::before
-- ::after
zonke ziya kudla ilifa box-sizing
okukhankanyiweyo .selector-for-some-widget
.
Funda ngakumbi malunga nemodeli yebhokisi kunye nokulinganisa kwiCSS Tricks .
Kunikezelo oluphuculweyo lwesikhangeli esinqamlezayo, sisebenzisa ukuQalisa kwakhona ukulungisa ukungangqinelani kwizikhangeli zonke kunye nezixhobo ngelixa sibonelela ngokusetha kwakhona okunoluvo olungakumbi kwizinto eziqhelekileyo zeHTML.
Hlala usexesheni kuphuhliso lweBootstrap kwaye ufikelele kuluntu ngezi zixhobo ziluncedo.
- Landela @getbootstrap kwi-Twitter .
- Funda kwaye ubhalise kwiBlog ye-Bootstrap esemthethweni .
- Thetha nabanye ooBootstrappers kwi-IRC. Kumncedisi
irc.freenode.net
,##bootstrap
kwitshaneli. - Uncedo lokuphumeza lunokufunyanwa kwi-Stack Overflow (iphawulwe
bootstrap-4
). - Abaphuhlisi kufuneka basebenzise igama elingundoqo
bootstrap
kwiipakethe ezitshintsha okanye zongeza kumsebenzi we-Bootstrap xa usasazwa nge- npm okanye iindlela zonikezelo ezifanayo zokufumana okuphezulu.
Unokulandela @getbootstrap kwi-Twitter ngentlebendwane yamva nje kunye neevidiyo zomculo ezothusayo.