Bootstrap ezimbiddwa ku grid eya 12-column eddamu. Tutaddemu n’ensengeka ez’obugazi obutakyukakyuka n’ez’amazzi nga zeesigamiziddwa ku nkola eyo.
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.
- <!EKITUNDU KY'EKIKULU html>
- <html lang = "luganda" >
- ...
- </html>
Munda mu fayiro ya scaffolding.less , tuteekawo okulaga okw’ensi yonna okusookerwako, okuwandiika, n’emisono gy’okuyunga. Okusingira ddala, ffe:
background-color: white;
ku ...body
@baseFontFamily
, @baseFontSize
, @baseLineHeight
n’ebintu ng’omusingi gwaffe ogw’okuwandiika@linkColor
era osiige ennyiriri eziriko ennyiriri zokka ku:hover
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.
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.
- <div class = "olunyiriri" >
- <div ekibiina = "span4" > ... </div>
- <div ekibiina = "span8" > ... </div>
- </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.
- <div class = "olunyiriri" >
- <div ekibiina = "span4" > ... </div>
- <div kiraasi = "span4 okukyusakyusa4" > ... </div>
- </div> nga bwe kiri
Nga olina enkola ya grid eya static (etali ya mazzi) mu Bootstrap, okuteeka ebisu kyangu. Okuteeka ebirimu byo, yongerako empya .row
n’ekibinja .span*
ky’ennyiriri munda mu mpagi eriwo .span*
.
Ennyiriri eziteekeddwa mu kisenge zirina okubeeramu ekibinja ky'ennyiriri ezigatta ku muwendo gw'ennyiriri z'omuzadde gwayo. Okugeza, .span3
empagi bbiri eziteekeddwa mu kisenge zirina okuteekebwa munda mu .span6
.
- <div class = "olunyiriri" >
- <div ekibiina = "span6" >
- Omutendera 1 omuko
- <div class = "olunyiriri" >
- <div class = "span3" > Omutendera 2 </div>
- <div class = "span3" > Omutendera 2 </div>
- </div> nga bwe kiri
- </div> nga bwe kiri
- </div> nga bwe kiri
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.
Fuula amazzi g'olunyiriri lwonna ng'okyusakyusa .row
n'ofuuka .row-fluid
. Empagi zisigala nga ze zimu ddala, ekigifuula super straightforward okukyusa wakati fixed ne fluid layouts.
- <div class = "olunyiriri-amazzi" >
- <div ekibiina = "span4" > ... </div>
- <div ekibiina = "span8" > ... </div>
- </div> nga bwe kiri
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.
- <div class = "olunyiriri-amazzi" >
- <div ekibiina = "span12" >
- Omutendera 1 ogw’ennyiriri
- <div class = "olunyiriri-amazzi" >
- <div class = "span6" > Omutendera 2 </div>
- <div class = "span6" > Omutendera 2 </div>
- </div> nga bwe kiri
- </div> nga bwe kiri
- </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 |
Ebizimbibwa mu Bootstrap waliwo enkyukakyuka ntono ez’okulongoosa enkola ya 940px grid eya bulijjo, ewandiikiddwa waggulu. Enkyukakyuka zonna eza grid ziterekebwa mu variables.less.
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.
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 esookerwako era ennyangu eya 940px-wide, centered layout kumpi ku mukutu gwonna oba omuko oguwereddwa omu <div class="container">
.
- <omubiri>
- <div class = "ekintu ekitereka" >
- ...
- </div> nga bwe kiri
- </omubiri>
<div class="container-fluid">
egaba ensengeka y'olupapula ekyukakyuka, min- ne max-widths, n'oludda olwa kkono. Kirungi nnyo ku apps ne docs.
- <div class = "ekibya-amazzi" >
- <div class = "olunyiriri-amazzi" >
- <div ekibiina = "span2" >
- <!--Ebiri mu bbali-->
- </div> nga bwe kiri
- <div ekibiina = "span10" >
- <!--Ebiri mu mubiri-->
- </div> nga bwe kiri
- </div> nga bwe kiri
- </div> nga bwe kiri
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-width
ne max-width
.
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.
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 |
Okukakasa nti ebyuma biraga bulungi empapula eziddamu, ssaamu viewport meta tag.
- <meta name = "viewport" content = "obugazi=obugazi-ekyuma, ekipimo-ekisookerwako=1.0" >
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:
Lwaki tomala kugissaamu? Amazima gagamba nti buli kimu kye kyetaaga okuba eky’okuddamu. Mu kifo ky’okukubiriza abakola okuggyawo ekintu kino, tukifuba okukisobozesa.
- /* Amasimu aga landscape ne wansi */
- @media ( obugazi obusinga obunene : 480px ) { ... } .
- /* Essimu ya Landscape okutuuka ku tabuleti y'ebifaananyi */
- @media ( obugazi obusinga obunene : 767px ) { ... } .
- /* Ekifaananyi kya tablet ku landscape ne desktop */
- @media ( obugazi bwa butono : 768px ) ne ( obugazi obusinga obunene : 979px ) { ... }
- /* Desktop ennene */ .
- @media ( obugazi bwa butono : 1200px ) { ... } .
Okusobola okukulaakulanya amangu essimu, kozesa ebika bino ebikulu eby’omugaso okulaga n’okukweka ebirimu okusinziira ku kyuma.
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.
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 | Okukweekebwa | Okukweekebwa |
.visible-tablet |
Okukweekebwa | Kirabika | Okukweekebwa |
.visible-desktop |
Okukweekebwa | Okukweekebwa | Kirabika |
.hidden-phone |
Okukweekebwa | Kirabika | Kirabika |
.hidden-tablet |
Kirabika | Okukweekebwa | Kirabika |
.hidden-desktop |
Kirabika | Kirabika | Okukweekebwa |
Kyuusa sayizi ya browser yo oba load ku byuma eby’enjawulo okugezesa classes ezo waggulu.
Obubonero obwa kiragala bulaga nti kiraasi erabika mu kifo kyo eky'okulabamu kati.
Wano, obubonero bwa kiragala bulaga nti kiraasi ekwekeddwa mu viewport yo eriwo kati.