Bootstrap wuxuu ku dhisan yahay 12-column xayndaabyo jawaab celin leh, qaabayn, iyo qaybo.
Bootstrap waxay isticmaashaa walxaha HTML qaarkood iyo sifooyinka CSS ee u baahan isticmaalka HTML5 doctype. Ku dar bilawga dhammaan mashaariicdaada.
- <!DOCTYPE html>
- <html lang = "en" >
- ...
- </html>
Bootstrap wuxuu dejiyaa bandhig caalami ah oo aasaasi ah, sawir-qoris, iyo qaababka isku xirka. Gaar ahaan, waxaanu:
margin
jirkabackground-color: white;
dhejibody
@baseFontFamily
, @baseFontSize
, iyo @baseLineHeight
sifooyinka sida saldhigga qoraalladayada@linkColor
oo mari xariiqyada hoose oo keliya:hover
Qaababkaan waxaa laga heli karaa gudaha qashinka . ka yar .
Iyadoo Bootstrap 2, dib-u-dejinta hore ee dib-u-dejinta ayaa hoos loo dhigay iyada oo loo eegayo Normalize.css , mashruuca Nicolas Gallagher iyo Jonathan Neal oo sidoo kale awood u leh HTML5 Boilerplate . In kasta oo aan isticmaalno wax badan oo ka mid ah Normalize gudaha dib-u -dejinteena.less , waxaan ka saarnay waxyaabo gaar ah Bootstrap.
Nidaamka iskuxiran ee Bootstrap-ka caadiga ah wuxuu isticmaalaa 12 tiir , samaynta weel ballaaran oo 940px ah iyada oo aan sifooyin jawaab celin ah la siin. Iyada oo lagu daray faylka CSS ee jawaabta leh, shabaggu wuxuu la qabsanayaa inuu noqdo 724px iyo 1170px ballaaran iyadoo ku xiran aragtidaada. Ka hooseeya 767px daawashada, tiiraryadu waxay noqonayaan dareere oo si toos ah u dul saaran.
Qaabka laba tiir ee fudud, samee a .row
oo ku dar tirada saxda ah ee .span*
tiirarka. Maaddaama kani yahay 12-column shabag, mid kastaa .span*
wuxuu gaarayaa tiro ka mid ah 12 tiir, waana in had iyo jeer lagu daro ilaa 12 saf kasta (ama tirada tiirarka ee waalidka).
- <div class = " saf" >
- <div class = "span4" > ... </div>
- <div class = "span8" > ... </div>
- </div>
Marka la eego tusaalahan, waxaanu haynaa .span4
iyo .span8
, samaynta 12 tiirar oo dhan iyo saf dhamaystiran.
Tiirarka u dhaqaaq dhanka midig adigoo isticmaalaya .offset*
fasalo. Fasal kastaa wuxuu ku kordhiyaa darafyada bidix ee tiirarka oo dhan. Tusaale ahaan, waxa .offset4
uu .span4
ka wareegayaa afar tiir.
- <div class = " saf" >
- <div class = "span4" > ... </div>
- <div class = "span3 offset2" > ... </div>
- </div>
Si aad macluumaadkaaga ugu dhejiso shabagga caadiga ah, ku dar tiirar cusub .row
iyo set oo ah .span*
tiir jira .span*
. Safafka buulka leh waa in ay ku jiraan tiro tiirar ah oo isku geynaya tirada tiirarka waalidkeed.
- <div class = " saf" >
- <div class = "span9" >
- Heerka 1 tiirka
- <div class = " saf" >
- <div class = "span6" > Heerka 2 </div>
- <div class = "span3" > Heerka 2 </div>
- </div>
- </div>
- </div>
Nidaamka shabagga dareeraha ah wuxuu isticmaalaa boqolleyda halkii pixels ee ballaadhka tiirka. Waxay leedahay awood isku mid ah oo ka jawaab celin ah sida nidaamkayaga qulqulka go'an, hubinta saamiga saxda ah ee xallinta shaashadda muhiimka ah iyo qalabka.
Samee saf kasta "dareere" adigoo u .row
beddelaya .row-fluid
. Fasallada tiirarku waa isku mid, taas oo sahlaysa in la isku rogo inta u dhaxaysa xargaha go'an iyo kuwa dareeraha ah.
- <div class = "dareere-dheecaan" >
- <div class = "span4" > ... </div>
- <div class = "span8" > ... </div>
- </div>
Waxa uu u shaqeeyaa si la mid ah sida nidaamka grid-ka go'an uu u dejiyo: ku dar .offset*
tiir kasta si aad u damiso tiirarkaas badan.
- <div class = "dareere-dheecaan" >
- <div class = "span4" > ... </div>
- <div class = "span4 offset2" > ... </div>
- </div>
Shabaqyada dareeraha ah waxay u isticmaalaan buul si kala duwan: heer kasta oo buul ah oo tiirar ah waa inuu ku daraa ilaa 12 tiir. Tani waa sababta oo ah shabagga dareeraha wuxuu isticmaalaa boqolleyda, ma aha pixels, dejinta ballaca.
- <div class = "dareere-dheecaan" >
- <div class = "span12" >
- Dheecaan 12
- <div class = "dareere-dheecaan" >
- <div class = "span6" >
- Dheecaan 6
- <div class = "dareere-dheecaan" >
- <div class = "span6" > dareeraha 6 </div>
- <div class = "span6" > dareeraha 6 </div>
- </div>
- </div>
- <div class = "span6" > dareeraha 6 </div>
- </div>
- </div>
- </div>
Wuxuu bixiyaa qaab-ballac go'an (iyo ikhtiyaari ahaan ka jawaabaya) nashqadaynta oo kaliya <div class="container">
loo baahan yahay.
- <jir>
- <div class = "konteenar" >
- ...
- </div>
- </body>
Abuur dareere, bog laba ka kooban oo leh <div class="container-fluid">
— ku fiican codsiyada iyo dukumentiyada.
- <div class = "container-fluid" >
- <div class = "dareere-dheecaan" >
- <div class = "span2" >
- <!--Content sidebar-->
- </div>
- <div class = "span10" >
- <!--Qoddobka Jidhka-->
- </div>
- </div>
- </div>
Daar CSS ka jawaabaya mashruucaaga adiga oo ku dara astaanta meta ee saxda ah iyo xaashida qaab oo dheeraad ah oo ku dhex jirta <head>
dukumeentigaaga. Haddii aad ka soo ururisay Bootstrap bogga Customize, waxaad u baahan tahay oo kaliya in aad ku darto summada meta.
- <meta name = "viewport" content = "ballad=qalabka-ballaadhka, bilowga-miisaanka=1.0" >
- <link href = "assets/css/bootstrap-responsive.css" rel = "stylesheet" >
Madaxa kor u qaad!Bootstrap kuma jiraan sifooyin ka jawaabaya si caadi ah wakhtigan sababtoo ah wax walba uma baahna inay noqdaan kuwo ka jawaabaya. Halkii aan ku dhiirigelin lahayn horumarinta si ay meeshan uga saaraan, waxaan ogaanay inay ugu fiican tahay inaan awoodno marka loo baahdo.
Weydiimaha warbaahintu waxay u oggolaanayaan CSS caado ah oo ku salaysan tiro shuruudo ah - saamiyo, ballaca, nooca bandhigga, iwm - laakiin badanaa waxay diiradda saaraan hareeraha min-width
iyo max-width
.
U isticmaal su'aalaha warbaahinta si mas'uuliyadi ku jirto oo kaliya sida bilawga dhagaystayaashaada mobaylka. Mashruucyada waaweyn, ka fiirso saldhigyada koodka ee ha u eegin lakabyada weydiimaha warbaahinta.
Bootstrap waxay taageertaa su'aalo yar oo warbaahin ah oo ku jira hal fayl si ay uga caawiso inay mashaariicdaada ka dhigaan kuwo ku habboon aaladaha kala duwan iyo xallinta shaashadda. Waa kuwan waxa ku jira:
Summada | Balaadhka qaabaynta | Ballaca tiirka | Ballaca godka |
---|---|---|---|
Bandhig weyn | 1200px iyo in ka badan | 70px | 30px |
Asal ahaan | 980px iyo in ka badan | 60px | 20px |
Kiniinnada sawirka | 768px iyo wixii ka sareeya | 42px | 20px |
Taleefannada ku jira tablet-ka | 767px iyo ka hooseeya | Tiirar dareere ah, oo aan lahayn ballac go'an | |
Telefoonada | 480px iyo ka hooseeya | Tiirar dareere ah, oo aan lahayn ballac go'an |
- /* desktop weyn */
- @media ( daq - balac : 1200px ) { ... }
- /* Kiniin sawir leh oo ku socda muuqaalka iyo miiska */
- @media ( daq - ballac : 768px ) iyo ( ugu badnaan - ballac : 979px ) { ... }
- /* Taleefan muuqaal ah oo loogu talagalay kiniinka sawirka */
- @media ( ugu badnaan - ballac : 767px ) { ... }
- /* Taleefannada muuqaalka iyo hoos */
- @media ( ugu badnaan - ballac : 480px ) { ... }
Horumarka saaxiibtinimo ee moobilka dhaqsaha badan, u isticmaal fasaladan utility muujinta iyo qarinta waxyaabaha ku jira aaladda. Hoos waxaa ku yaal shax fasallada la heli karo iyo saamaynta ay ku leeyihiin qaabka su'aalaha warbaahinta la siiyay (oo lagu calaamadeeyay qalab). Waxa laga heli karaa responsive.less
.
Fasalka | Telefoonada767px iyo ka hooseeya | Kiniinnada979px ilaa 768px | MiisaankaAsal ahaan |
---|---|---|---|
.visible-phone |
Muuqda | Qarsoon | Qarsoon |
.visible-tablet |
Qarsoon | Muuqda | Qarsoon |
.visible-desktop |
Qarsoon | Qarsoon | Muuqda |
.hidden-phone |
Qarsoon | Muuqda | Muuqda |
.hidden-tablet |
Muuqda | Qarsoon | Muuqda |
.hidden-desktop |
Muuqda | Muuqda | Qarsoon |
U isticmaal si xaddidan oo iska ilaali abuurista noocyo kala duwan oo isla goobta ah. Taa beddelkeeda, u isticmaal si aad u dhammaystirto soo bandhigida qalab kasta. Utility ka jawaabaya waa in aan lagu isticmaalin miisaska, sidaas darteedna lama taageero.
Dib u qiyaas biraawsarkaaga ama ku shub qalab kala duwan si aad u tijaabiso fasalada sare
Calaamadaha cagaarka ah waxay muujinayaan in fasalka uu ka muuqanayo aragtidaada hadda.
Halkan, calaamadaha cagaarka ah waxay muujinayaan in fasalka uu ku qarsoon yahay aragtidaada hadda.