Okukola ebikondo

Bootstrap ezimbiddwa ku grid eya 12-column eddamu. Tutaddemu n’ensengeka ez’obugazi obutakyukakyuka n’ez’amazzi nga zeesigamiziddwa ku nkola eyo.

Yeetaaga HTML5 doctype

Bootstrap ekozesa ebintu bya HTML n'ebintu bya CSS ebyetaagisa okukozesa HTML5 doctype. Kakasa nti ogiteeka ku ntandikwa ya buli lupapula lwa Bootstrapped mu pulojekiti yo.

  1. <!EKITUNDU KY'EKIKULU html>
  2. <html lang = "luganda" >
  3. ...
  4. </html>

Typography n’enkolagana

Munda mu fayiro ya scaffolding.less , tuteekawo okulaga okw’ensi yonna okusookerwako, okuwandiika, n’emisono gy’okuyunga. Okusingira ddala, ffe:

  • Ggyawo margin ku mubiri
  • Teeka background-color: white;ku ...body
  • Kozesa @baseFontFamily, @baseFontSize, @baseLineHeightn’ebintu ng’omusingi gwaffe ogw’okuwandiika
  • Teeka langi y'enkolagana ey'ensi yonna ng'oyita mu @linkColorera osiige ennyiriri eziriko ennyiriri zokka ku:hover

Reset nga oyita mu Normalize

Okuva ku Bootstrap 2, okuddamu okuteekawo CSS okw’ennono kweyongedde okukozesa ebintu okuva mu Normalize.css , pulojekiti eya Nicolas Gallagher nayo ekola amaanyi ku HTML5 Boilerplate .

Okuddamu okupya kukyayinza okusangibwa mu reset.less , naye nga waliwo ebintu bingi ebiggiddwawo olw'obumpimpi n'obutuufu.

1.
1.
1.
1.
1.
1.
1.
1.
1.
1.
1.
1.
4.
4.
4.
4.
8.
6.
6.
12. 12

Enkola ya grid esookerwako ewereddwa mu Bootstrap ekozesa ennyiriri 12 eziraga ku bugazi bwa 724px, 940px (esookera ddala nga tewali CSS eddamu), ne 1170px. Wansi w’ebifo eby’okulaba ebya 767px, empagi zifuuka amazzi era ne zituula mu vertikal.

  1. <div class = "olunyiriri" >
  2. <div ekibiina = "span4" > ... </div>
  3. <div ekibiina = "span8" > ... </div>
  4. </div> nga bwe kiri

Nga bwe kiragibwa wano, ensengeka enkulu esobola okutondebwawo nga erina "ennyiriri" bbiri, buli emu ekwata ku muwendo gw'ennyiriri 12 ez'omusingi ze twannyonnyola ng'ekitundu ky'enkola yaffe eya giridi.


Okukyusakyusa empagi

4.
4 okukyusakyusa 4
3 okukyusakyusa 3
3 okukyusakyusa 3
8 okukyusakyusa 4
  1. <div class = "olunyiriri" >
  2. <div ekibiina = "span4" > ... </div>
  3. <div kiraasi = "span4 okukyusakyusa4" > ... </div>
  4. </div> nga bwe kiri

Empagi z’okuzimba ebisu

Nga olina enkola ya grid eya static (etali ya mazzi) mu Bootstrap, okuteeka ebisu kyangu. Okuteeka ebirimu byo, yongerako empya .rown’ekibinja .span*ky’ennyiriri munda mu mpagi eriwo .span*.

Eky'okulabirako

Ennyiriri eziteekeddwa mu kisenge zirina okubeeramu ekibinja ky'ennyiriri ezigatta ku muwendo gw'ennyiriri z'omuzadde gwayo. Okugeza, .span3empagi bbiri eziteekeddwa mu kisenge zirina okuteekebwa munda mu .span6.

Omutendera 1 ogw’ennyiriri
Omutendera 2
Omutendera 2
  1. <div class = "olunyiriri" >
  2. <div ekibiina = "span6" >
  3. Omutendera 1 omuko
  4. <div class = "olunyiriri" >
  5. <div class = "span3" > Omutendera 2 </div>
  6. <div class = "span3" > Omutendera 2 </div>
  7. </div> nga bwe kiri
  8. </div> nga bwe kiri
  9. </div> nga bwe kiri

Empagi z’amazzi

1.
1.
1.
1.
1.
1.
1.
1.
1.
1.
1.
1.
4.
4.
4.
4.
8.
6.
6.
12. 12

Ebitundu ku kikumi, so si pixels

Enkola ya fluid grid ekozesa ebitundu ku kikumi ku bugazi bw’empagi mu kifo kya pixels ezitakyukakyuka. Era erina enjawulo eziddamu ze zimu nga enkola yaffe eya fixed grid, okukakasa ebipimo ebituufu ku key screen resolutions n’ebyuma.

Ennyiriri z’amazzi

Fuula amazzi g'olunyiriri lwonna ng'okyusakyusa .rown'ofuuka .row-fluid. Empagi zisigala nga ze zimu ddala, ekigifuula super straightforward okukyusa wakati fixed ne fluid layouts.

Okuteeka obubonero

  1. <div class = "olunyiriri-amazzi" >
  2. <div ekibiina = "span4" > ... </div>
  3. <div ekibiina = "span8" > ... </div>
  4. </div> nga bwe kiri

Okuzimba ebisu mu mazzi

Okuzimba ebisu n’ebisenge by’amazzi kya njawulo katono: omuwendo gw’ennyiriri eziteekeddwa mu kisu tegwetaaga kukwatagana na muzadde. Wabula, ennyiriri zo ziddamu okuteekebwa ku buli mutendera kubanga buli lunyiriri lutwala ebitundu 100% ku mpagi y’omuzadde.

Amazzi 12
Amazzi 6
Amazzi 6
  1. <div class = "olunyiriri-amazzi" >
  2. <div ekibiina = "span12" >
  3. Omutendera 1 ogw’ennyiriri
  4. <div class = "olunyiriri-amazzi" >
  5. <div class = "span6" > Omutendera 2 </div>
  6. <div class = "span6" > Omutendera 2 </div>
  7. </div> nga bwe kiri
  8. </div> nga bwe kiri
  9. </div> nga bwe kiri
Enkyukakyuka Omuwendo ogusookerwako Okunnyonnyola
@gridColumns 12. 12 Omuwendo gw’ennyiriri
@gridColumnWidth 60px nga bwe kiri Obugazi bwa buli mpagi
@gridGutterWidth 20px nga bwe kiri Ekifo ekitali kirungi wakati w’empagi

Enkyukakyuka mu LESS

Ebizimbibwa mu Bootstrap waliwo enkyukakyuka ntono ez’okulongoosa enkola ya 940px grid eya bulijjo, ewandiikiddwa waggulu. Enkyukakyuka zonna eza grid ziterekebwa mu variables.less.

Engeri y’okulongoosaamu

Okukyusa grid kitegeeza okukyusa enkyukakyuka essatu @grid*n’okuddamu okukung’aanya Bootstrap. Kyusa enkyukakyuka za grid mu variables.less era okozese emu ku ngeri ennya eziwandiikiddwa okuddamu okukung'aanya . Bw'oba oyongerako ennyiriri endala, kakasa nti ossaako CSS y'abo abali mu grid.less.

Okusigala ng’oddamu

Okulongoosa giridi kikola ku ddaala erisookerwako lyokka, giridi ya 940px. Okukuuma ensonga eziddamu eza Bootstrap, era ojja kuba olina okulongoosa grids mu responsive.less.

Enteekateeka eteredde

Enteekateeka esookerwako era ennyangu eya 940px-wide, centered layout kumpi ku mukutu gwonna oba omuko oguwereddwa omu <div class="container">.

  1. <omubiri>
  2. <div class = "ekintu ekitereka" >
  3. ...
  4. </div> nga bwe kiri
  5. </omubiri>

Ensengeka y’amazzi

<div class="container-fluid">egaba ensengeka y'olupapula ekyukakyuka, min- ne max-widths, n'oludda olwa kkono. Kirungi nnyo ku apps ne docs.

  1. <div class = "ekibya-amazzi" >
  2. <div class = "olunyiriri-amazzi" >
  3. <div ekibiina = "span2" >
  4. <!--Ebiri mu bbali-->
  5. </div> nga bwe kiri
  6. <div ekibiina = "span10" >
  7. <!--Ebiri mu mubiri-->
  8. </div> nga bwe kiri
  9. </div> nga bwe kiri
  10. </div> nga bwe kiri

Ebyuma ebiddamu

Bye bakola

Ebibuuzo by’emikutu bikkiriza CSS eya bulijjo okusinziira ku mbeera eziwerako—emigerageranyo, obugazi, ekika ky’okwolesebwa, n’ebirala—naye ebiseera ebisinga essira liteekeddwa okwetooloola min-widthne max-width.

  • Kyuusa obugazi bw’ennyiriri mu giridi yaffe
  • Stack elements mu kifo ky’okulengejja wonna we kyetaagisa
  • Kyuusa obunene bw’emitwe n’ebiwandiiko okusobola okutuukira ddala ku byuma

Kozesa ebibuuzo by’emikutu gy’amawulire mu ngeri ey’obuvunaanyizibwa era ng’entandikwa yokka eri abalabi bo ku ssimu. Ku pulojekiti ennene, lowooza ku misingi gya koodi egy’okwewaayo so si layers z’okubuuza kw’emikutu.

Ebyuma ebiwagirwa

Bootstrap ewagira okubuuza kw’emikutu okutonotono mu fayiro emu okuyamba okufuula pulojekiti zo okutuukira ddala ku byuma eby’enjawulo n’okusalawo kwa screen. Bino bye birimu:

Erinnya Obugazi bw’ensengeka Obugazi bw’empagi Obugazi bwa gutter
Essimu ez’amaanyi 480px ne wansi Empagi z’amazzi, tewali bugazi bunywevu
Essimu ez’amaanyi okutuuka ku ttabuleeti 767px ne wansi Empagi z’amazzi, tewali bugazi bunywevu
Ebipande by’ebifaananyi 768px n’okudda waggulu 42px nga bwe kiri 20px nga bwe kiri
Okukosamu 980px n’okudda waggulu 60px nga bwe kiri 20px nga bwe kiri
Okwolesebwa okunene 1200px n’okudda waggulu 70px nga bwe kiri 30px nga bwe kiri

Yeetaaga meta tag

Okukakasa nti ebyuma biraga bulungi empapula eziddamu, ssaamu viewport meta tag.

  1. <meta name = "viewport" content = "obugazi=obugazi-ekyuma, ekipimo-ekisookerwako=1.0" >

Okukozesa ebibuuzo by’emikutu gy’amawulire

Bootstrap terimu bibuuzo bino eby’emikutu mu ngeri ey’otoma, naye okubitegeera n’okubigattako kyangu nnyo era kyetaagisa okuteekawo okutono. Olina engeri ntono gy’oyinza okussaamu ebikozesebwa ebiddamu ebya Bootstrap:

  1. Kozesa enkyusa y'okuddamu ekung'aanyiziddwa, bootstrap-responsive.css
  2. Okwongerako @import "responsive.less" era oddemu okukuŋŋaanya Bootstrap
  3. Kyuusa era oddemu okukuŋŋaanya responsive.less nga fayiro ey'enjawulo

Lwaki tomala kugissaamu? Amazima gagamba nti buli kimu kye kyetaaga okuba eky’okuddamu. Mu kifo ky’okukubiriza abakola okuggyawo ekintu kino, tukifuba okukisobozesa.

  1. /* Amasimu aga landscape ne wansi */
  2. @media ( obugazi obusinga obunene : 480px ) { ... } .
  3.  
  4. /* Essimu ya Landscape okutuuka ku tabuleti y'ebifaananyi */
  5. @media ( obugazi obusinga obunene : 767px ) { ... } .
  6.  
  7. /* Ekifaananyi kya tablet ku landscape ne desktop */
  8. @media ( obugazi bwa butono : 768px ) ne ( obugazi obusinga obunene : 979px ) { ... }
  9.  
  10. /* Desktop ennene */ .
  11. @media ( obugazi bwa butono : 1200px ) { ... } .

Ebisulo by’ebikozesebwa ebiddamu

Ziri ki

Okusobola okukulaakulanya amangu essimu, kozesa ebika bino ebikulu eby’omugaso okulaga n’okukweka ebirimu okusinziira ku kyuma.

Ddi lw’olina okukozesa

Kozesa ku musingi omutono era weewale okukola enkyusa ez’enjawulo ddala ez’omukutu gwe gumu. Mu kifo ky’ekyo, zikozese okujjuliza ennyanjula ya buli kyuma.

Okugeza, oyinza okulaga <select>elementi ya nav ku layouts z’essimu, naye si ku tablets oba desktops.

Okuwagira emisomo

Elagiddwa wano emmeeza ya kiraasi ze tuwagira n’engeri gye zikwata ku nteekateeka y’okubuuza kw’emikutu eweereddwa (ewandiikiddwa ku kyuma). Ziyinza okusangibwa mu responsive.less.

Essomo Amasimu480px ne wansi Empeke ezikozesebwa767px ne wansi Ebikozesebwa ku mmeeza768px n’okudda waggulu
.visible-phone Kirabika
.visible-tablet Kirabika
.visible-desktop Kirabika
.hidden-phone Kirabika Kirabika
.hidden-tablet Kirabika Kirabika
.hidden-desktop Kirabika Kirabika

Omusango gw'okugezesa

Kyuusa sayizi ya browser yo oba load ku byuma eby’enjawulo okugezesa classes ezo waggulu.

Kirabika ku...

Obubonero obwa kiragala bulaga nti kiraasi erabika mu kifo kyo eky'okulabamu kati.

  • Essimu✔ Essimu
  • Empeke✔ Empeke
  • Desktop y’oku mmeeza✔ Ku mmeeza

Ekwekeddwa ku...

Wano, obubonero bwa kiragala bulaga nti kiraasi ekwekeddwa mu viewport yo eriwo kati.

  • Essimu✔ Essimu
  • Empeke✔ Empeke
  • Desktop y’oku mmeeza✔ Ku mmeeza