CSS
Useto lweGlobal CSS, izinto ezisisiseko zeHTML ezenziwe ngesitayile zaza zaphuculwa ngeeklasi ezandisiweyo, kunye nenkqubo yegridi ephucukileyo.
Useto lweGlobal CSS, izinto ezisisiseko zeHTML ezenziwe ngesitayile zaza zaphuculwa ngeeklasi ezandisiweyo, kunye nenkqubo yegridi ephucukileyo.
Fumana ukuhla kwiziqwenga eziphambili zesiseko seBootstrap, kubandakanya nendlela yethu yokuphucula, ngokukhawuleza, nokuqina kwewebhu.
I-Bootstrap isebenzisa izinto ezithile ze-HTML kunye neempawu zeCSS ezifuna ukusetyenziswa kwe-HTML5 doctype. Yifake ekuqaleni kwazo zonke iiprojekthi zakho.
NgeBootstrap 2, songeze izitayile ezithandekayo ezizikhethelayo zeselfowuni kwimiba ephambili yesakhelo. NgeBootstrap 3, siyibhale kwakhona iprojekthi ukuba isebenziseka ngokulula ukusuka ekuqaleni. Endaweni yokongeza kwizitayile ezizikhethelayo zeselfowuni, zibhakwa ngqo kumbindi. Ngapha koko, i-Bootstrap ihamba phambili . Izimbo zokuqala eziphathwayo zinokufunyanwa kwithala leencwadi liphela endaweni yeefayile ezahlukeneyo.
Ukuqinisekisa unikezelo olululo kunye nokuchukumisa ukwandisa, yongeza i-meta tag ye-viewport kweyakho <head>
.
Ungakhubaza isakhono sokwandisa kwizixhobo eziphathwayo ngokongeza user-scalable=no
kwimeta tag yokujonga. Oku kukhubaza ukusondeza, oku kuthetha ukuba abasebenzisi bayakwazi ukuskrola kuphela, kwaye kukhokelela ekubeni indawo yakho ivakale ngakumbi njengesicelo somthonyama. Lilonke, asikucebisi oku kuyo yonke indawo, ke sebenzisa isilumkiso!
I-Bootstrap iseta umboniso osisiseko wehlabathi jikelele, ukuchwetheza, kunye nezimbo zekhonkco. Ngokukodwa, thina:
background-color: #fff;
kwibody
@font-family-base
,, @font-size-base
kunye @line-height-base
neempawu njengesiseko sethu sokuchwetheza@link-color
kwaye usebenzise ikhonkco elikrwelelayo kuphela:hover
Ezi ndlela zinokufumaneka ngaphakathi scaffolding.less
.
Kunikezelo oluphuculweyo lwesikhangeli, sisebenzisa Normalize.css , iprojekthi kaNicolas Gallagher kunye noJonathan Neal .
I-Bootstrap ifuna into equlathe into yokusonga imixholo yesayithi kunye nendlu yenkqubo yethu yegridi. Unokukhetha esinye sezikhongozeli ezibini oza kuzisebenzisa kwiiprojekthi zakho. Qaphela ukuba, ngenxa padding
nangaphezulu, akukho sikhongozeli sihleliyo.
Ukusetyenziswa .container
kwisikhongozeli sobubanzi obusisigxina esiphendulayo.
Sebenzisa .container-fluid
kwisikhongozeli esibanzi esigcweleyo, esithatha bonke ububanzi bendawo yokujonga yakho.
I-Bootstrap ibandakanya ukusabela, inkqubo yegridi yokuqala ye-fluid ehamba ngokufanelekileyo ukuya kwiikholamu ezili-12 njengoko isixhobo okanye ubungakanani bombono bonyuka. Ibandakanya iiklasi ezichazwe kwangaphambili zokhetho olulula loyilo, kunye nemixube enamandla yokuvelisa uyilo lwesemantic ngakumbi .
Iinkqubo zegridi zisetyenziselwa ukudala iiplani zephepha ngoluhlu lwemigca kunye neekholamu ezigcina umxholo wakho. Nantsi indlela yokusebenza kwegridi yeBootstrap:
.container
(ububanzi obumiselweyo) okanye .container-fluid
(ububanzi obupheleleyo) ukulungiselela ulungelelwaniso olufanelekileyo kunye nokukhuselwa..row
kwaye .col-xs-4
ziyafumaneka ukwenza ngokukhawuleza uyilo lwegridi. Imixube encinci ingasetyenziselwa ukubekwa kwesemantic.padding
. Loo padding ikhutshiwe kwimiqolo yokuqala kunye nekholamu yokugqibela ngokusebenzisa umda ongalunganga kwi- .row
s..col-xs-4
..col-md-*
iklasi kwinto ayizukuchaphazela kuphela isimbo sayo kwizixhobo eziphakathi kodwa nakwizixhobo ezikhulu ukuba .col-lg-*
iklasi ayikho.Jonga kwimizekelo yokusebenzisa le migaqo kwikhowudi yakho.
Sisebenzisa le mibuzo ilandelayo yeendaba kwiifayile zethu eziNcinane ukwenza iindawo zokuqhawuka eziphambili kwinkqubo yethu yegridi.
Ngamathuba athile sandisa le mibuzo yemidiya ukubandakanya max-width
ukukhawulela i-CSS kwiseti encinci yezixhobo.
Jonga indlela imiba yendlela yegridi yeBootstrap esebenza ngayo kuzo zonke izixhobo ezininzi ezinetafile ephathwayo.
Izixhobo ezincinci ezongezelelweyo iiFowuni (<768px) | Izixhobo ezincinci zetafile (≥768px) | Izixhobo eziPhakathi zeDesktop (≥992px) | Izixhobo ezikhulu zeDesktop (≥1200px) | |
---|---|---|---|---|
Ukuziphatha kwegridi | Ithe tyaba ngamaxesha onke | Igoqiwe ukuqalisa, ithe tyaba ngasentla kweendawo zokuqhawula | ||
Ububanzi bomgqomo | Akukho (auto) | 750px | 970px | 1170px |
Isimaphambili seklasi | .col-xs- |
.col-sm- |
.col-md- |
.col-lg- |
# yeentsika | 12 | |||
Ububanzi bekholamu | Ngokuzenzekelayo | ~62px | ~81px | ~97px |
Ububanzi bomsele | 30px (15px kwicala ngalinye lekholamu) | |||
Nestable | Ewe | |||
I-Offsets | Ewe | |||
Ukuodola ikholamu | Ewe |
Usebenzisa iseti enye .col-md-*
yeeklasi zegridi, unokwenza inkqubo yegridi esisiseko eqala ngokupakishwa kwizixhobo eziphathwayo kunye nezixhobo zethebhulethi (eyongezelelweyo incinci ukuya kuluhlu oluncinci) phambi kokuba ithe tye kwidesktop (ephakathi) izixhobo. Beka iikholamu zegridi kuyo nayiphi na .row
.
Guqula naluphi na uhlobo loyilo lwegridi yobubanzi obusisigxina ibeyiyo yobubanzi obugcweleyo ngokutshintsha umphandle wakho .container
ube .container-fluid
.
Awufuni ukuba iikholamu zakho zibeke ngokulula kwizixhobo ezincinci? Sebenzisa iiklasi zegridi ezincinci neziphakathi ngokudibanisa .col-xs-*
.col-md-*
kwiikholamu zakho. Jonga lo mzekelo ungezantsi ukuze ufumane ingcamango engcono yendlela esebenza ngayo yonke into.
Yakha kumzekelo wangaphambili ngokwenza iziyilo ezinamandla ngakumbi nezinamandla .col-sm-*
ngeeklasi zethebhulethi.
Ukuba ngaphezu kweekholamu ezili-12 zibekwe ngaphakathi kumqolo omnye, iqela ngalinye leekholamu ezongezelelweyo liya kuthi, njengeyunithi enye, isonge kumgca omtsha.
Ngamanqanaba amane eegridi akhoyo unyanzelekile ukuba ungene kwimiba apho, kwiindawo ezithile zokuphumla, iikholamu zakho azicaci kakuhle njengoko enye inde kunomnye. Ukulungisa oko, sebenzisa indibaniselwano a .clearfix
kunye neeklasi eziluncedo eziphendulayo .
Ukongeza kwikholamu yokucoca kwiindawo ezisabelayo, unokufuna ukuseta ngokutsha ii-offsets, utyhala, okanye utsalo . Bona oku kwisenzo kumzekelo wegridi .
Hambisa iikholamu ekunene usebenzisa .col-md-offset-*
iiklasi. Ezi klasi zonyusa umda wasekhohlo wekholam *
ngokweekholamu. Umzekelo, .col-md-offset-4
uhamba .col-md-4
ngaphaya kweekholamu ezine.
Unokuphinda ukhuphele ngaphezulu i-offsets ukusuka kwimigangatho yegridi esezantsi .col-*-offset-0
ngeeklasi.
Ukuxhoma umxholo wakho ngegridi engagqibekanga, yongeza entsha .row
kunye neseti .col-sm-*
yeekholamu ngaphakathi koluhlu olukhoyo .col-sm-*
. Imiqolo ebekwe kwizindlu kufuneka ibandakanye uluhlu lwezintlu ezidibanisa ukuya kutsho kwi-12 okanye ngaphantsi (akufuneki ukuba usebenzise zonke iikholamu ezili-12 ezikhoyo).
Guqula ngokulula ulungelelwaniso lweekholamu zethu zegridi ezakhelwe ngaphakathi kunye .col-md-push-*
neeklasi .col-md-pull-*
zesilungisi.
Ukongeza kwiiklasi zegridi ezakhelwe kwangaphambili zoyilo olukhawulezayo, iBootstrap ibandakanya ukuguquguquka okuNcinane kunye nemixube ukuze uvelise ngokukhawuleza eyakho ilula, uyilo lwesemantic.
Izinto eziguquguqukayo zimisela inani leekholamu, ububanzi begutter, kunye nendawo yombuzo wemidiya apho kuza kuqalwa khona iikholamu ezidadayo. Sisebenzisa ezi ukuvelisa iiklasi zegridi ezichazwe kwangaphambili ezibhalwe ngasentla, kunye nemixube yesiko edweliswe ngezantsi.
Imixube isetyenziswa ngokudityaniswa noguquguquko lwegridi ukuvelisa i-CSS ye-semantic yeekholamu zegridi nganye.
Uyakwazi ukuguqula izinto eziguquguqukayo kumaxabiso akho esiko, okanye usebenzise nje imixube ngexabiso labo elingagqibekanga. Nanku umzekelo wokusebenzisa useto olungagqibekanga ukwenza ubeko lwekholamu ezimbini kunye nomsantsa phakathi.
Zonke izihloko ze-HTML, <h1>
nge- <h6>
, ziyafumaneka. .h1
ngeeklasi zikwakhona .h6
, xa ufuna ukuthelekisa isimbo somgca wesihloko kodwa usafuna okubhaliweyo kwakho kuboniswe emgceni.
h1. Isihloko seBootstrap |
Semibold 36px |
h2. Isihloko seBootstrap |
Semibold 30px |
h3. Isihloko seBootstrap |
Semibold 24px |
h4. Isihloko seBootstrap |
Semibold 18px |
h5. Isihloko seBootstrap |
Semibold 14px |
h6. Isihloko seBootstrap |
Semibold 12px |
Yenza isicatshulwa esikhaphukhaphu, esisesekondari kuso nasiphi na isihloko esinethegi eqhelekileyo <small>
okanye .small
iklasi.
h1. Isihloko se-Bootstrap Umbhalo wesibini |
h2. Isihloko se-Bootstrap Umbhalo wesibini |
h3. Isihloko se-Bootstrap Umbhalo wesibini |
h4. Isihloko se-Bootstrap Umbhalo wesibini |
h5. Isihloko se-Bootstrap Umbhalo wesibini |
h6. Isihloko se-Bootstrap Umbhalo wesibini |
Ukungagqibekanga kweBootstrap yehlabathi font-size
yi- 14px , kunye ne line-height
- 1.428 . Oku kusetyenziselwa kuyo <body>
yonke imihlathi. Ukongeza, <p>
(imihlathi) ifumana umda osezantsi wesiqingatha sobude bayo obubaliweyo bomgca (10px ngokungagqibekanga).
Nullam quis risus eget urna mollis ornare vel eu leo. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nullam id dolor id nibh ultricies vehicula.
Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Kwenziwe ullamcorper nulla non metus auctor fringilla. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Kwenziwe ullamcorper nulla non metus auctor fringilla.
Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit.
Yenza umhlathi ugqame ngokongeza .lead
.
Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Duis mollis, est non commodo luctus.
Isikali sokuchwetheza sisekelwe kwizinto ezimbini eziNcinci kwi- variables.less : @font-size-base
kunye @line-height-base
. Eyokuqala sisiseko sobukhulu befonti esetyenziswa kuyo yonke indawo kwaye eyesibini bubude bomgca wesiseko. Sisebenzisa ezo ziguquguqukayo kunye nezibalo ezilula ukwenza imida, iipadi, kunye nokuphakama kwemigca yalo lonke uhlobo lwethu nokunye. Yenza ngokwezifiso kunye ne-Bootstrap iqhelanisa.
Ukuqaqambisa ukuqhutywa kokubhaliweyo ngenxa yokufaneleka kwayo komnye umxholo, sebenzisa <mark>
ithegi.
Ungasebenzisa ithegi yamanqaku kuqaqambisaumbhalo.
Ukubonisa iibhloko zeteksti ezicinyiweyo sebenzisa <del>
ithegi.
Lo mgca wokubhaliweyo wenzelwe ukuphathwa njengombhalo ocinyiweyo.
Ukubonisa iibhloko zombhalo ezingasasebenziyo sebenzisa <s>
ithegi.
Lo mgca wokubhaliweyo wenzelwe ukuba uthathwe njengongasachanekanga.
Ukubonisa izongezo kuxwebhu sebenzisa <ins>
ithegi.
Lo mgca wokubhaliweyo wenzelwe ukuphathwa njengokongeza kuxwebhu.
Ukukrwelela okubhaliweyo sebenzisa <u>
ithegi.
Lo mgca wokubhaliweyo uya kwenza njengoko ukrwelelwe umgca ngaphantsi
Sebenzisa iithegi ze-HTML zogxininiso olungagqibekanga ezinezimbo ezikhaphukhaphu.
Ukungagxininisi kumgca okanye iibhloko zombhalo, sebenzisa <small>
ithegi ukuseta umbhalo kuma-85% ubukhulu bomzali. Izihloko zesihloko zifumana ezazo font-size
kwizinto ezinendlwane <small>
.
Ungasebenzisa enye into engaphakathi .small
endaweni yayo nayiphi na <small>
.
Lo mgca wokubhaliweyo wenzelwe ukuphathwa njengoshicilelo olucolekileyo.
Ukugxininisa i-snippet yesicatshulwa esinobunzima befonti enzima.
Isiqwengana esilandelayo sokubhaliweyo sinikezelwa njengombhalo ongqindilili .
Ukugxininisa isiqwengana sokubhaliweyo okukekeleyo.
Esi siqwengana silandelayo sokubhaliweyo sinikezelwa njengombhalo okekeleyo .
Zive ukhululekile ukusebenzisa <b>
nakwi <i>
-HTML5. <b>
yenzelwe ukuqaqambisa amagama okanye amabinzana ngaphandle kokudlulisela ukubaluleka okongeziweyo ngelixa <i>
ubukhulu becala iselizwi, amagama obugcisa, njl.
Ukulungelelanisa isicatshulwa ngokulula kumacandelo aneeklasi zolungelelwaniso lokubhaliweyo.
Umbhalo olungelelaniswe ekhohlo.
Isiqendu esilungelelaniswe embindini.
Isiqendu esilungelelaniswe ekunene.
Isicatshulwa esithethelelekayo.
Akukho mbhalo wokusonga.
Guqula okubhaliweyo kumacandelo ngeeklasi zokubhala ngoonobumba abakhulu.
Umbhalo osezantsi.
Umbhalo obhalwe ngoonobumba abakhulu.
Isicatshulwa esibhalwe ngoonobumba abakhulu.
Uzalisekiso olucwangcisiweyo lwesiqalelo se-HTML <abbr>
kwizifinyezo kunye nee-akhronimi ukubonisa uguqulelo olwandisiweyo kwi-hover. Ushunqulelo olunophawu title
loyelelwano lunomda osezantsi onamachaphaza okukhanya kunye nekhesa yoncedo kwi-hover, ibonelela ngomongo owongezelelweyo kwi-hover kunye nakubasebenzisi boncedo lobuchwepheshe.
Isishunqulelo segama loyelelwano sithi attr .
Yongeza .initialism
kwisifinyezo sefonti encinci kancinane.
I- HTML yeyona nto ilungileyo ukusukela kwisonka esisikiweyo.
Bonisa iinkcukacha zoqhagamshelwano zoyena khokho ukufutshane okanye wonke umsebenzi. Gcina ukufomatha ngokuphelisa yonke imigca nge <br>
.
Ukucaphula iibhloko zomxholo komnye umthombo ngaphakathi koxwebhu lwakho.
Gquba <blockquote>
malunga nayo nayiphi na i- HTML njengesicatshulwa. Kwiingcaphuno ezithe ngqo, sincoma i <p>
.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. I-integer posuere erat ante.
Isimbo kunye nesiqulatho sitshintsha kwiinguqu ezilula kumgangatho <blockquote>
.
Yongeza u-a <footer>
ukuze uchonge umthombo. Gquba igama lomthombo womsebenzi kwi <cite>
.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. I-integer posuere erat ante.
Yongeza .blockquote-reverse
kwi-blockquote enomxholo olungelelaniswe ekunene.
Uluhlu lwezinto apho umyalelo awubalulekanga ngokucacileyo .
Uluhlu lwezinto apho ulandelelwano lubaluleke kakhulu.
Susa umda ongagqibekanga list-style
kunye nowasekhohlo kwizinto zoluhlu (abantwana bangoku kuphela). Oku kusebenza kuphela kwizinto zoluhlu lwabantwana olukhawulezileyo , okuthetha ukuba kuya kufuneka wongeze iklasi kulo naluphi na uluhlu olubekwe kwindlwane ngokunjalo.
Beka zonke izinto zoluhlu kumgca omnye kunye display: inline-block;
ne-padding ekhanyayo.
Uluhlu lwamagama aneenkcazo ezinxulumene nawo.
Yenza imigaqo kunye neenkcazo <dl>
ngokulandelelana kwicala elinye. Iqala ngokupakishwa njengokungagqibekanga <dl>
s, kodwa xa i navbar isanda, yenza njalo ezi.
Uluhlu lwenkcazelo ethe tye luya kucutha amagama amade kakhulu ukuba angangena kuluhlu lwasekhohlo nge text-overflow
. Kwiindawo zokujonga ezimxinwa, ziya kutshintshela kuyilo olupakishweyo olungagqibekanga.
Songa iziqwengana zekhowudi nge <code>
.
<section>
kufuneka isongwe njengomgca.
Sebenzisa i- <kbd>
ukubonisa igalelo elidla ngokungeniswa nge-keyboard.
Sebenzisa <pre>
kwimigca emininzi yekhowudi. Qiniseka ukuba ubaleka naziphi na izibiyeli ze-engile kwikhowudi yonikezelo olufanelekileyo.
<p>Isampuli yombhalo apha...</p>
Unokukhetha ukongeza .pre-scrollable
iklasi, eya kuseka ubude bobude obuyi-350px kwaye ibonelele nge-y-axis scrollbar.
Ukubonisa izinto ezahlukeneyo sebenzisa <var>
ithegi.
y = m x + b
Ukubonisa iibhloko zemveliso yesampulu kwinkqubo sebenzisa <samp>
ithegi.
Oku kubhaliweyo kujongwe ukuba kuthathwe njengesampulu ephuma kwiprogram yekhompyutha.
Kwi-styling esisiseko-i-padding ekhanyayo kunye ne-horizontal dividers kuphela-yongeza iklasi yesiseko .table
kuyo nayiphi na <table>
. Isenokubonakala iyinto engafunekiyo, kodwa ngenxa yokusetyenziswa ngokubanzi kweetafile kwezinye iiplagi ezinje ngekhalenda kunye nabakhethi bemihla, sikhethe ukwahlula izitayile zethu zetafile yesiko.
# | Igama lokuqala | Ifani | Igama lomsebenzisi |
---|---|---|---|
1 | Phawula | Otto | @mdo |
2 | uYakobi | Thornton | @fat |
3 | Larry | intaka |
Sebenzisa .table-striped
ukudibanisa zebra-striping kuwo nawuphi na umqolo wetafile ngaphakathi kwe <tbody>
.
Iitafile ezinemigca zenziwe ngesikhethi :nth-child
seCSS, esingafumanekiyo kwi-Internet Explorer 8.
# | Igama lokuqala | Ifani | Igama lomsebenzisi |
---|---|---|---|
1 | Phawula | Otto | @mdo |
2 | uYakobi | Thornton | @fat |
3 | Larry | intaka |
Yongeza .table-bordered
imida kumacala onke etafile kunye neeseli.
# | Igama lokuqala | Ifani | Igama lomsebenzisi |
---|---|---|---|
1 | Phawula | Otto | @mdo |
2 | uYakobi | Thornton | @fat |
3 | Larry | intaka |
Yongeza .table-hover
ukwenza imo ye hover kwimigca yetafile ngaphakathi kwe <tbody>
.
# | Igama lokuqala | Ifani | Igama lomsebenzisi |
---|---|---|---|
1 | Phawula | Otto | @mdo |
2 | uYakobi | Thornton | @fat |
3 | Larry | intaka |
Yongeza .table-condensed
ukwenza iitafile zihlangane ngakumbi ngokusika i-cell padding kwisiqingatha.
# | Igama lokuqala | Ifani | Igama lomsebenzisi |
---|---|---|---|
1 | Phawula | Otto | @mdo |
2 | uYakobi | Thornton | @fat |
3 | Larry intaka |
Sebenzisa iiklasi zomxholo ukufaka imibala kwimigca yetafile okanye iiseli ezizimeleyo.
Iklasi | Inkcazo |
---|---|
.active |
Ifaka umbala wehover kumqolo othile okanye iseli |
.success |
Ibonisa isenzo esiyimpumelelo okanye esilungileyo |
.info |
Ibonisa inguqu yolwazi engathathi hlangothi okanye isenzo |
.warning |
Ibonisa isilumkiso esinokufuna ingqalelo |
.danger |
Ibonisa isenzo esinobungozi okanye esinokuthi sibe sibi |
# | Isihloko sekholamu | Isihloko sekholamu | Isihloko sekholamu |
---|---|---|---|
1 | Umxholo weKholam | Umxholo weKholam | Umxholo weKholam |
2 | Umxholo weKholam | Umxholo weKholam | Umxholo weKholam |
3 | Umxholo weKholam | Umxholo weKholam | Umxholo weKholam |
4 | Umxholo weKholam | Umxholo weKholam | Umxholo weKholam |
5 | Umxholo weKholam | Umxholo weKholam | Umxholo weKholam |
6 | Umxholo weKholam | Umxholo weKholam | Umxholo weKholam |
7 | Umxholo weKholam | Umxholo weKholam | Umxholo weKholam |
8 | Umxholo weKholam | Umxholo weKholam | Umxholo weKholam |
9 | Umxholo weKholam | Umxholo weKholam | Umxholo weKholam |
Ukusebenzisa umbala ukongeza intsingiselo kumqolo wetheyibhile okanye kwiseli nganye kunika kuphela isalathiso esibonakalayo, esingayi kuthunyelwa kubasebenzisi bobugcisa bokuncedisa - ezifana nezifundi zesikrini. Qinisekisa ukuba ulwazi olubonakaliswe ngumbala luyabonakala kumxholo ngokwawo (umbhalo obonakalayo kumqolo ofanelekileyo wetheyibhile/iseli), okanye ubandakanywe ngezinye iindlela, ezinjengombhalo owongezelelweyo ofihliweyo .sr-only
neklasi.
Yenza iitheyibhile eziphendulayo ngokusonga nayiphi na .table
ngaphakathi .table-responsive
ukuze zisongele ngokuthe tye kwizixhobo ezincinci (phantsi kwe-768px). Xa ujonge kuyo nantoni na enkulu kuno-768px ububanzi, awuzukubona mahluko kwezi theyibhile.
Iitheyibhile eziphendulayo zisebenzisa overflow-y: hidden
i-, ekhuphela nawuphi na umxholo ongaphaya komzantsi okanye kumphetho wetafile. Ngokukodwa, oku kunokuqhawula iimenyu ezihlayo kunye nezinye iiwijethi zomntu wesithathu.
IFirefox inesimbo esingathandekiyo seseti ebandakanya width
ephazamisana netafile ephendulayo. Oku akunako ukukhutshwa ngaphandle kwe-Firefox-i-hack ethile esingaboneleli ngayo kwi-Bootstrap:
Ngolwazi oluthe vetshe, funda le mpendulo yokuHamba kweSitaki .
# | Isihloko setheyibhile | Isihloko setheyibhile | Isihloko setheyibhile | Isihloko setheyibhile | Isihloko setheyibhile | Isihloko setheyibhile |
---|---|---|---|---|---|---|
1 | Iseli yetafile | Iseli yetafile | Iseli yetafile | Iseli yetafile | Iseli yetafile | Iseli yetafile |
2 | Iseli yetafile | Iseli yetafile | Iseli yetafile | Iseli yetafile | Iseli yetafile | Iseli yetafile |
3 | Iseli yetafile | Iseli yetafile | Iseli yetafile | Iseli yetafile | Iseli yetafile | Iseli yetafile |
# | Isihloko setheyibhile | Isihloko setheyibhile | Isihloko setheyibhile | Isihloko setheyibhile | Isihloko setheyibhile | Isihloko setheyibhile |
---|---|---|---|---|---|---|
1 | Iseli yetafile | Iseli yetafile | Iseli yetafile | Iseli yetafile | Iseli yetafile | Iseli yetafile |
2 | Iseli yetafile | Iseli yetafile | Iseli yetafile | Iseli yetafile | Iseli yetafile | Iseli yetafile |
3 | Iseli yetafile | Iseli yetafile | Iseli yetafile | Iseli yetafile | Iseli yetafile | Iseli yetafile |
Ulawulo lwefomu yomntu ngamnye lufumana ngokuzenzekelayo isimbo sehlabathi. Konke okubhaliweyo <input>
, <textarea>
, kunye <select>
nezinto .form-control
ezinezicwangciswe width: 100%;
ngokungagqibekanga. Gquba iilebhile kunye nolawulo .form-group
ukuze ufumane izithuba ezifanelekileyo.
Musa ukudibanisa amaqela efomu ngokuthe ngqo namaqela ongeniso . Endaweni yoko, gcina iqela legalelo ngaphakathi kwiqela lefom.
Yongeza .form-inline
kwifomu yakho (enganyanzelekanga ukuba ibeyi <form>
) yolungelelwaniso olusekhohlo kunye nolawulo lwebhloko engaphakathi. Oku kusebenza kuphela kwiifomu ezingaphakathi kwendawo yokujonga enobuncinci be-768px ububanzi.
Amagalelo kunye nokhetho width: 100%;
lusetyenziswe ngokungagqibekanga kwiBootstrap. Ngaphakathi kweefom ze-inline, siseta kwakhona ukuba width: auto;
ulawulo oluninzi lunokuhlala kumgca omnye. Kuxhomekeka kuyilo lwakho, ububanzi besiko olongezelelweyo lunokufuneka.
Abafundi besikrini baya kuba nengxaki ngeefomu zakho ukuba awubandakanyi ileyibhile yalo lonke igalelo. Kwezi fom zangaphakathi, ungazifihla iilebhile usebenzisa .sr-only
iklasi. Kukho ezinye iindlela ezizezinye zokubonelela ngeleyibhile yeetekhnoloji ezincedisayo, ezifana ne- aria-label
, aria-labelledby
okanye title
uphawu. Ukuba akukho nanye kwezi ekhoyo, abafundi besikrini banokubhenela ekusebenziseni placeholder
uphawu, ukuba lukhona, kodwa qaphela ukuba ukusetyenziswa placeholder
kwendawo yezinye iindlela zokuleyibheli akucetyiswa.
Sebenzisa iiklasi zegridi ezichazwe kwangaphambili zeBootstrap ukulungelelanisa iilebhile kunye namaqela olawulo lwefomu kuyilo oluthe tye ngokongeza .form-horizontal
kwifomu (enganyanzelekanga ukuba ibeyi <form>
). Ukwenza njalo kuyatshintsha .form-group
s ukuziphatha njengemigca yegridi, ngoko akukho mfuneko .row
.
Imizekelo yolawulo lweefom eziqhelekileyo ezixhaswa kuyilo lwefom yomzekelo.
Uninzi lwefomu yolawulo oluxhaphakileyo, imimandla yokufaka esekwe ngokubhaliweyo. Iquka inkxaso yazo zonke iindidi zeHTML5: text
, password
, datetime
, datetime-local
, date
, month
, time
, , week
, number
, email
, url
, search
, tel
, kunye color
.
Amagalelo aya kubhalwa ngokupheleleyo kuphela ukuba awo type
abhengezwe ngokufanelekileyo.
Ukongeza okubhaliweyo okuhlanganisiweyo okanye amaqhosha ngaphambi kunye/okanye emva kwayo nayiphi na itekisi esekwe <input>
, jonga inxalenye yegalelo leqela .
Ulawulo lwefom oluxhasa imigca emininzi yokubhaliweyo. Guqula rows
uphawu xa kuyimfuneko.
Iibhokisi zokukhangela zezokukhetha enye okanye iinketho ezininzi kuluhlu, ngelixa oonomathotholo bezokukhetha ukhetho olunye kwabaninzi.
Iibhokisi zokukhangela ezikhubazekileyo kunye nonomathotholo ziyaxhaswa, kodwa ukunika ikhesa "engavumelekanga" kwihover yomzali <label>
, kuya kufuneka wongeze .disabled
iklasi kumzali .radio
, .radio-inline
, .checkbox
, okanye .checkbox-inline
.
Sebenzisa .checkbox-inline
okanye .radio-inline
iiklasi kuthotho lweebhokisi zokukhangela okanye iirediyo kulawulo oluvela kumgca omnye.
Ukuba awunambhalo ngaphakathi kwe <label>
, igalelo libekwe ngendlela obunokulindela ngayo. Okwangoku isebenza kuphela kwiibhokisi ezingezizo emgceni kunye nonomathotholo. Khumbula ukuba usenokubonelela ngolunye uhlobo lweleyibhile yeetekhnoloji ezincedisayo (umzekelo, ukusebenzisa aria-label
).
Qaphela ukuba ezininzi iimenyu ezikhethiweyo zemveli-ezizezi kwi-Safari kunye ne-Chrome-zineekona ezijikelezileyo ezingenakuguqulwa border-radius
ngeepropati.
Kulawulo <select>
olunophawu multiple
, iinketho ezininzi ziboniswa ngokungagqibekanga.
Xa ufuna ukubeka isicatshulwa esicacileyo ecaleni kwelebhile yefom ekwifom, sebenzisa .form-control-static
iklasi kwi- <p>
.
Sisusa izimbo ezingagqibekanga outline
kulawulo oluthile kwaye sisebenzise u a box-shadow
endaweni yalo :focus
.
:focus
ImekoLo mzekelo ungentla ungenisa usebenzisa izimbo zesiko kuxwebhu lwethu ukubonisa :focus
imeko kwi .form-control
.
Yongeza disabled
uphawu lwe boolean kwigalelo ukuthintela ukusebenzisana komsebenzisi. Amagalelo akhubazekileyo abonakala ekhaphukhaphu kwaye wongeza not-allowed
ikhesa.
Yongeza disabled
uphawu ku a <fieldset>
ukuvala zonke izilawuli ngaphakathi <fieldset>
ngaxeshanye.
<a>
Ngokungagqibekanga, abakhangeli bazakuthatha lonke uhlobo lolawulo lwendalo ( <input>
, <select>
kunye <button>
nezakhi) ngaphakathi <fieldset disabled>
njengokukhubaziweyo, ukuthintela zombini ibhodi yezitshixo kunye nonxibelelwano lwemouse kuzo. Nangona kunjalo, ukuba ifom yakho ikwabandakanya <a ... class="btn btn-*">
izinto, ezi ziya kunikwa kuphela isimbo se pointer-events: none
. Njengoko kuphawuliwe kwicandelo malunga nemeko yabakhubazekileyo yamaqhosha (kwaye ngokukodwa kwicandelo elingaphantsi lezinto ze-ankile), le propati ye-CSS ayikamiswanga kwaye ayixhaswanga ngokupheleleyo kwi-Opera 18 nangaphantsi, okanye kwi-Internet Explorer 11, kwaye iphumelele. 'ukuthintela abasebenzisi bebhodi yezitshixo ukuba bangakwazi ukugxila okanye ukuvula la makhonkco. Ke ukuze ukhuseleke, sebenzisa iJavaScript yesiko ukuvala amakhonkco anjalo.
Ngelixa i-Bootstrap izakusebenzisa ezi zimbo kuzo zonke iibhrawuza, i-Internet Explorer 11 nangezantsi ayiluxhasi ngokupheleleyo disabled
uphawu lwe- <fieldset>
. Sebenzisa iJavaScript yesiko ukuvala iseti yangaphandle kwezi bhrawuza.
Yongeza readonly
uphawu lwe boolean kwigalelo ukunqanda ukulungiswa kwexabiso legalelo. Amagalelo okufunda kuphela abonakala ekhaphukhaphu (njengamagalelo avaliweyo), kodwa gcina ikhesa esemgangathweni.
Inqanaba lebhlokhi yoncedo lokubhaliweyo kulawulo lwefom.
Isicatshulwa soncedo kufuneka sidityaniswe ngokucacileyo nolawulo lwefom enxulumene nokusebenzisa aria-describedby
uphawu loyelelwano. Oku kuya kuqinisekisa ukuba iitekhnoloji ezincedisayo - ezifana nezifundi zesikrini - ziya kubhengeza lo mbhalo woncedo xa umsebenzisi egxile okanye engena kulawulo.
I-Bootstrap ibandakanya izitayile zokuqinisekisa impazamo, isilumkiso, kunye nempumelelo ithi kulawulo lwefom. Ukusebenzisa, ukongeza .has-warning
, .has-error
, okanye .has-success
into engumzali. Nayiphi na .control-label
, .form-control
kwaye .help-block
ngaphakathi kweso siqalelo siya kufumana izimbo zokuqinisekisa.
Ukusebenzisa ezi ndlela zokuqinisekisa ukubonisa ubume bolawulo lwefom kubonelela kuphela ngembonakalo, isalathiso esekwe kumbala, esingayi kuhanjiswa kubasebenzisi betekhnoloji encedisayo - njengabafundi besikrini - okanye kubasebenzisi abangenambala.
Qinisekisa ukuba kukho enye into ebonisa urhulumente. Umzekelo, ungabandakanya ingcebiso malunga nelizwe <label>
kwisicatshulwa solawulo lwefomu ngokwayo (njengoko kunjalo kumzekelo wekhowudi elandelayo), bandakanya iGlyphicon (kunye nokubhaliweyo okufanelekileyo usebenzisa .sr-only
iklasi - bona imizekelo yeGlyphicon ), okanye ngokubonelela ibhloko yombhalo woncedo olongezelelweyo . Ngokukodwa kwiitekhnoloji ezincedisayo, ulawulo lwefom olungasebenziyo lunokwabelwa aria-invalid="true"
uphawu.
Unokongeza ii-iyikhoni zempendulo ozikhethelayo kunye .has-feedback
nomfanekiso ochanekileyo.
Iimpawu zeengxelo zisebenza kuphela ngezinto ezibhaliweyo <input class="form-control">
.
Ukubekwa ngokwezandla kwee-icon zengxelo kuyafuneka kumagalelo ngaphandle kweleyibhile nakumaqela egalelo anokongeza ngasekunene. Uyakhuthazwa ngamandla ukuba unikeze iilebhile zawo onke amagalelo ngenxa yezizathu zokufikeleleka. Ukuba unqwenela ukuthintela iilebhile ukuba zingavezwa, zifihle .sr-only
eklasini. Ukuba kufuneka wenze ngaphandle kweeleyibhile, lungisa top
ixabiso lomfanekiso wengxelo. Kumaqela egalelo, lungisa right
ixabiso kwixabiso elifanelekileyo lepixel ngokuxhomekeke kububanzi beaddon yakho.
Ukuqinisekisa ukuba iitekhnoloji ezincedisayo - njengezifundi zesikrini - ziyidlulisela ngokuchanekileyo intsingiselo ye-icon, isicatshulwa esongezelelweyo esifihliweyo kufuneka sibandakanywe .sr-only
eklasini kwaye sidityaniswe ngokucacileyo nolawulo lwefom ehambelana nokusebenzisa aria-describedby
. Kungenjalo, qinisekisa ukuba intsingiselo (umzekelo, inyani yokuba kukho isilumkiso sommandla othile wokungena okubhaliweyo) igqithiswa ngenye indlela, njengokutshintsha okubhaliweyo kweyona nto <label>
inxulumene nolawulo lwefom.
Nangona le mizekelo ilandelayo sele ikhankanyiwe ngemeko yongqinisiso yolawulo lwazo <label>
kwisicatshulwa ngokwaso, obu buchule bungentla (ukusebenzisa .sr-only
isicatshulwa kunye aria-describedby
) bubandakanyiwe ngeenjongo zokubonisa.
.sr-only
ezineelebhile ezifihliweyoUkuba usebenzisa .sr-only
iklasi ukufihla indlela yolawulo lwefomu <label>
(kunokusebenzisa ezinye iinketho zokulebhelisha, ezifana aria-label
nophawu), iBootstrap iya kulungelelanisa ngokuzenzekelayo indawo ye icon xa yongeziwe.
Cwangcisa ubude usebenzisa iiklasi ezifana .input-lg
, kwaye usete ububanzi usebenzisa iiklasi zekholamu yegridi njenge .col-lg-*
.
Yenza ulawulo olude okanye olufutshane oluhambelana nobukhulu beqhosha.
Iilebhile zesayizi ngokukhawuleza kunye nolawulo lwefom ngaphakathi .form-horizontal
ngokudibanisa .form-group-lg
okanye .form-group-sm
.
Songa amagalelo kwimiqolo yegridi, okanye nasiphi na isiko lomzali, ukunyanzelisa ngokulula ububanzi obufunekayo.
Sebenzisa iiklasi zamaqhosha kwi <a>
, <button>
, okanye <input>
isiqalelo.
Ngelixa iiklasi zeqhosha zinokusetyenziswa <a>
kunye <button>
nezakhi, kuphela <button>
izinto ezixhaswayo ngaphakathi kwe-nav yethu kunye namalungu e-navbar.
Ukuba <a>
izinto zisetyenziselwa ukwenza njengamaqhosha - ukuqalisa ukusebenza kwekhasi, kunokuba uhambe uye kwelinye uxwebhu okanye icandelo ngaphakathi kwephepha langoku - kufuneka kwakhona banikwe efanelekileyo role="button"
.
Njengomsebenzi ogqwesileyo, sincoma kakhulu ukusebenzisa <button>
isiqalelo xa kunokwenzeka ukuqinisekisa ukuthelekisa unikezelo lwebrowser.
Phakathi kwezinye izinto, kukho isiphene kwiFirefox <30 esithintelayo line-height
ekusetezeni <input>
amaqhosha asekiweyo, ebangela ukuba angahambelani ncam nobude bamanye amaqhosha kwiFirefox.
Sebenzisa naziphi na iiklasi ezikhoyo zamaqhosha ukwenza ngokukhawuleza iqhosha elinesitayile.
Ukusebenzisa umbala ukongeza intsingiselo kwiqhosha kunika kuphela isalathiso esibonakalayo, esingayi kuthunyelwa kubasebenzisi bobugcisa bokuncedisa - njengabafundi besikrini. Qinisekisa ukuba ulwazi oluchazwe ngumbala lubonakala luvela kumxholo ngokwawo (umbhalo obonakalayo weqhosha), okanye ubandakanyiwe ngeendlela ezizezinye, ezifana nesicatshulwa esongezelelweyo esifihliweyo kunye .sr-only
neklasi.
Unqwenela amaqhosha amakhulu okanye amancinci? Yongeza .btn-lg
, .btn-sm
, okanye .btn-xs
iisayizi ezongezelelweyo.
Yenza amaqhosha enqanaba lebhloko—lawo afikelela kububanzi obupheleleyo bomzali— ngokongeza .btn-block
.
Amaqhosha azakuvela ecinezelwe (ngemvelaphi emnyama, umda omnyama, kunye nesithunzi somfanekiso) xa usebenza. Kwizinto <button>
, oku kwenziwa nge :active
. Ukwenzela <a>
izinto, kwenziwa nge .active
. Nangona kunjalo, ungasebenzisa .active
kwi <button>
s (kwaye ubandakanye aria-pressed="true"
uphawu) kufuneka ufune ukuphinda-phinda imeko esebenzayo ngokwenkqubo.
Akukho mfuneko yokongeza :active
njengoko iyiklasi-pseudo, kodwa ukuba ufuna ukunyanzela inkangeleko efanayo, qhubeka kwaye wongeze .active
.
Yongeza .active
iklasi <a>
kumaqhosha.
Yenza amaqhosha abonakale engacoleki ngokuwacima nge opacity
.
Yongeza disabled
uphawu <button>
kumaqhosha.
Ukuba wongeza disabled
uphawu kwi <button>
, Internet Explorer 9 kwaye ngezantsi iyakwenza umbhalo ongwevu ngesithunzi sombhalo esibi esingenako ukusilungisa.
Yongeza .disabled
iklasi <a>
kumaqhosha.
Sisebenzisa .disabled
udidi oluluncedo apha, ngokufanayo .active
nodidi oluqhelekileyo, ngoko ke akukho simaphambili sifunekayo.
Olu didi lusebenzisa pointer-events: none
ukuzama ukukhubaza ukusebenza kwekhonkco le- <a>
s, kodwa loo propati ye-CSS ayikabikho emgangathweni kwaye ayixhaswanga ngokupheleleyo kwi-Opera 18 nangaphantsi, okanye kwi-Internet Explorer 11. Ukongeza, nakwiziphequluli ezixhasayo pointer-events: none
, ikhibhodi ukukhangela kuhlala kungachaphazeleki, nto leyo ethetha ukuba abasebenzisi bekhibhodi ababoniweyo kunye nabasebenzisi beetekhnoloji zokuncedisa baya kuba nakho ukuwenza asebenze la makhonkco. Ke ukuze ukhuseleke, sebenzisa iJavaScript yesiko ukuvala amakhonkco anjalo.
Imifanekiso kwi-Bootstrap 3 ingenziwa iphendule-friendly ngokongezwa .img-responsive
kweklasi. Oku kuyasebenza max-width: 100%;
, height: auto;
kwaye display: block;
kumfanekiso ukuze ulinganise kakuhle kwinto yomzali.
Ukusembindini imifanekiso esebenzisa .img-responsive
iklasi, sebenzisa .center-block
endaweni ye .text-center
. Jonga icandelo leeklasi zabancedisi ngeenkcukacha ezithe vetshe malunga .center-block
nokusetyenziswa.
Kwi-Internet Explorer 8-10, imifanekiso yeSVG enesayizi .img-responsive
engalinganiyo. Ukulungisa oku, yongeza width: 100% \9;
apho kuyimfuneko. I-Bootstrap ayisebenzisi oku ngokuzenzekelayo njengoko ibangela iingxaki kwezinye iifomati zemifanekiso.
Yongeza iiklasi <img>
kwinto ukwenza ngokulula isitayile imifanekiso kuyo nayiphi na iprojekthi.
Gcina ukhumbula ukuba i-Internet Explorer 8 ayinankxaso yeekona ezingqukuva.
Ukuhambisa intsingiselo ngombala ngeqela leeklasi eziluncedo zogxininiso. Ezi zinokusetyenziswa kumakhonkco kwaye ziya kuba mnyama kwi-hover kanye njengezimbo zethu zekhonkco ezingagqibekanga.
Fusce dapibus, tellus ac cursus commodo, tor mauris nibh.
Nullam id dolor id nibh ultricies vehicula ut id elit.
Duis mollis, est non commodo luctus, nisi erat porttitor ligula.
Maecenas sed diam eget risus varius blandit sit amet non magna.
Etiam porta sem malesuada magna mollis euismod.
Kwenziwe ullamcorper nulla non metus auctor fringilla.
Ngamanye amaxesha iiklasi zogxininiso azinakusetyenziswa ngenxa yento ethile yomnye umkhethi. Kwiimeko ezininzi, iworkaround eyaneleyo kukusonga isicatshulwa sakho <span>
ngeklasi.
Ukusebenzisa umbala ukongeza intsingiselo kubonelela kuphela ngesalathiso esibonakalayo, esingayi kuthunyelwa kubasebenzisi betekhnoloji encedisayo - njengezifundi zesikrini. Qinisekisa ukuba ulwazi olubonakaliswe ngumbala lucacile kumxholo ngokwawo (imibala yomxholo isetyenziselwa ukuqinisa intsingiselo esele ikhona kwisicatshulwa / uphawu), okanye ibandakanywe ngeendlela ezizezinye, ezinjengombhalo owongezelelweyo ofihliweyo kunye .sr-only
neklasi . .
Ngokufana neeklasi zombala wetekisi yomxholo, cwangcisa ngokulula imvelaphi yento kuyo nayiphi na iklasi yomxholo. Izinto ze-ankile ziya kuba mnyama kwi-hover, njengeeklasi zeteksti.
Nullam id dolor id nibh ultricies vehicula ut id elit.
Duis mollis, est non commodo luctus, nisi erat porttitor ligula.
Maecenas sed diam eget risus varius blandit sit amet non magna.
Etiam porta sem malesuada magna mollis euismod.
Kwenziwe ullamcorper nulla non metus auctor fringilla.
Ngamanye amaxesha iiklasi ezingemva kweemeko azinakusetyenziswa ngenxa yento ethile yomnye umkhethi. Kwezinye iimeko, i-workaround eyaneleyo kukusonga umxholo wento yakho <div>
kunye neklasi.
Njengakwimibala yomxholo , qinisekisa ukuba nayiphi na intsingiselo egqithiswa ngombala ikwagqithiswa ngefomathi engeyiyo inkcazo-ntetho kuphela.
Sebenzisa i-ayikhoni yokuvala eqhelekileyo ukugxotha umxholo onjengeemodyuli kunye nezilumkiso.
Sebenzisa iikharethi ukubonisa ukusebenza kokwehla kunye nesalathiso. Qaphela ukuba ukhathalelo oluhlala lukhona luya kubuya umva ngokuzenzekelayo kwiimenyu ezisukayo .
Ncanda into uye ekhohlo okanye ekunene ngeklasi. !important
ibandakanyiwe ukuphepha imiba ethile. Iiklasi zingasetyenziswa njengemixube.
Cwangcisa isiqalelo display: block
kumbindi nge margin
. Ifumaneka njengomxube kunye neklasi.
Cacisa ngokulula float
s ngokongeza .clearfix
kwinto engumzali . Isebenzisa i-micro clearfix njengoko ithandwa nguNicolas Gallagher. Inokusetyenziswa kwakhona njengomxube.
Nyanzelisa into ukuba iboniswe okanye ifihlwe ( kubandakanywa nezifundi zekhusi ) ngokusetyenziswa .show
kunye .hidden
neeklasi. Ezi klasi zisebenzisa !important
ukunqanda ungquzulwano oluthile, njengokudada okukhawulezayo . Zifumaneka kuphela kwizinga lebhloko lokuguqula. Zisenokusetyenziswa njengemixube.
.hide
iyafumaneka, kodwa ayisoloko ichaphazela abafundi besikrini kwaye iyarhoxa njenge-v3.0.1. Sebenzisa .hidden
okanye .sr-only
endaweni yoko.
Ngaphaya koko, .invisible
inokusetyenziselwa ukuguqula kuphela ukubonakala kwento, oku kuthetha display
ukuba ayilungiswanga kwaye isiqalelo sisenokuchaphazela ukuhamba koxwebhu.
Fihla into kuzo zonke izixhobo ngaphandle kwezifundi zesikrini ezine .sr-only
. Dibanisa nokubonisa .sr-only
into .sr-only-focusable
kwakhona xa igxininiswe (umzekelo ngumsebenzisi webhodi yezitshixo kuphela). Kuyimfuneko ekulandeleni ezona ndlela zofikelelo zingcono . Inokusetyenziswa kwakhona njengemixube.
Sebenzisa .text-hide
iklasi okanye i-mixin ukunceda ukubuyisela umxholo wesicatshulwa ngomfanekiso ongasemva.
Kuphuhliso olukhawulezayo lweselula, sebenzisa ezi klasi ziluncedo ekuboniseni nasekufihleni umxholo ngesixhobo ngombuzo wemidiya. Kukwaqukwe iiklasi eziluncedo zokuguqula umxholo xa ushicilelwe.
Zama ukusebenzisa ezi siseko silinganiselwe kwaye uphephe ukwenza iinguqulelo ezahlukeneyo ngokupheleleyo kwindawo enye. Endaweni yoko, zisebenzise ukuncedisana neprizenteyishini yesixhobo ngasinye.
Sebenzisa enye okanye indibaniselwano yeeklasi ezikhoyo zokuguqula umxholo kuzo zonke iindawo zokubukela.
Izixhobo ezincinci ezongezelelweyoIifowuni (<768px) | Izixhobo ezincinciIitafile (≥768px) | Izixhobo eziphakathiIideskithophu (≥992px) | Izixhobo ezinkuluIideskithophu (≥1200px) | |
---|---|---|---|---|
.visible-xs-* |
Iyabonakala | Ifihliwe | Ifihliwe | Ifihliwe |
.visible-sm-* |
Ifihliwe | Iyabonakala | Ifihliwe | Ifihliwe |
.visible-md-* |
Ifihliwe | Ifihliwe | Iyabonakala | Ifihliwe |
.visible-lg-* |
Ifihliwe | Ifihliwe | Ifihliwe | Iyabonakala |
.hidden-xs |
Ifihliwe | Iyabonakala | Iyabonakala | Iyabonakala |
.hidden-sm |
Iyabonakala | Ifihliwe | Iyabonakala | Iyabonakala |
.hidden-md |
Iyabonakala | Iyabonakala | Ifihliwe | Iyabonakala |
.hidden-lg |
Iyabonakala | Iyabonakala | Iyabonakala | Ifihliwe |
Ukusukela kwi-v3.2.0, .visible-*-*
iiklasi zebreakpoint nganye ziza ngokweenguqu ezintathu, enye display
ngexabiso lepropathi yeCSS nganye edweliswe ngezantsi.
Iqela leeklasi | CSSdisplay |
---|---|
.visible-*-block |
display: block; |
.visible-*-inline |
display: inline; |
.visible-*-inline-block |
display: inline-block; |
Ke, kwizinto ezincinci ( xs
) izikrini zomzekelo, .visible-*-*
iiklasi ezikhoyo zezi: .visible-xs-block
, .visible-xs-inline
, kunye .visible-xs-inline-block
.
Iiklasi .visible-xs
, .visible-sm
, .visible-md
, kwaye .visible-lg
zikwakhona, kodwa ziyekisiwe njenge v3.2.0 . Ziphantse zilingane .visible-*-block
, ngaphandle kweemeko ezongezelelweyo ezikhethekileyo zokuguqula- <table>
ezinxulumene nezinto.
Ngokufana neeklasi eziqhelekileyo eziphendulayo, sebenzisa ezi ukuguqula umxholo wokuprinta.
Iiklasi | Isikhangeli | Shicilela |
---|---|---|
.visible-print-block .visible-print-inline .visible-print-inline-block |
Ifihliwe | Iyabonakala |
.hidden-print |
Iyabonakala | Ifihliwe |
Iklasi.visible-print
nayo ikhona kodwa iyekisiwe njenge-v3.2.0. Iphantse ilingane .visible-print-block
no-, ngaphandle kweemeko ezongezelelweyo ezikhethekileyo kwizinto ezinxulumene- <table>
nento.
Yenza ubungakanani bebrowser yakho okanye ulayishe kwizixhobo ezahlukeneyo ukuvavanya iiklasi eziluncedo eziphendulayo.
Iimpawu zokukhangela eziluhlaza zibonisa into iyabonakala kwindawo yakho yokujonga yangoku.
Apha, amanqaku okukhangela aluhlaza abonisa kwakhona into efihliweyo kwindawo yakho yokujonga yangoku.
I-Bootstrap's CSS yakhelwe kuNcinane, iprosesa yangaphambili enomsebenzi owongezelelweyo onjengezinto eziguquguqukayo, imixube, kunye nemisebenzi yokuqulunqa iCSS. Abo bajonge ukusebenzisa umthombo Iifayile ezincinci endaweni yeefayile zethu ezihlanganisiweyo zeCSS zinokusebenzisa iinguqu ezininzi kunye nemixube esiyisebenzisayo kwisakhelo sonke.
Izinto eziguquguqukayo zegridi kunye nemixube zigqunyelelwe ngaphakathi kwecandelo lenkqubo yeGridi .
I-Bootstrap ingasetyenziswa ubuncinane ngeendlela ezimbini: nge-CSS ehlanganisiweyo okanye ngomthombo Iifayile ezingaphantsi. Ukuqokelela iifayile eziNcinane, jonga icandelo elithi Ukuqalisa malunga nendlela yokucwangcisa imeko-bume yakho yophuhliso ukusebenzisa imiyalelo eyimfuneko.
Izixhobo zokuhlanganisa zomntu wesithathu zinokusebenza neBootstrap, kodwa azixhaswa liqela lethu eliphambili.
Izinto eziguquguqukayo zisetyenziswa kuyo yonke iprojekthi njengendlela yokubeka embindini kunye nokwabelana ngexabiso eliqhelekileyo elisetyenziswa njengemibala, izithuba, okanye izitaki zefonti. Ukuze ufumane ulwahlulo olupheleleyo, nceda ubone uMthengi .
Kulula ukusebenzisa izikimu zemibala emibini: igreyscale kunye nesemantic. Imibala engwevu inika ufikelelo olukhawulezayo kwimithunzi emnyama esetyenziswa ngokuqhelekileyo ngelixa i-semantic iquka imibala eyahlukeneyo eyabelwe amaxabiso anentsingiselo yomxholo.
Sebenzisa naziphi na ezi ziguquguqukayo zemibala njengoko zinjalo okanye uzinike kwakhona kwizinto ezinentsingiselo ngakumbi kwiprojekthi yakho.
Iqela lezinto eziguquguqukayo zokwenza ngokwezifiso izinto eziphambili zamathambo esayithi lakho.
Yenza ngokulula amakhonkco akho ngombala ochanekileyo onexabiso elinye kuphela.
Qaphela ukuba @link-hover-color
isebenzisa umsebenzi, esinye isixhobo esoyikekayo esisuka kuMncinci, ukwenza ngokuzenzekelayo umbala ochanekileyo we-hover. Ungasebenzisa darken
, lighten
, saturate
, kunye desaturate
.
Seta ngokulula isimbo sakho sokuchwetheza, ubungakanani bombhalo, ukukhokela, kunye nokunye okuguquguqukayo okumbalwa okukhawulezayo. I-Bootstrap yenza ukusetyenziswa kwezi kunye nokubonelela ngemixube yokuchwetheza elula.
Iinguqu ezimbini ezikhawulezayo zokwenza ngokwezifiso indawo kunye negama lefayile yee-icon zakho.
Izixhobo kuyo yonke iBootstrap zisebenzisa ezinye iinguqu ezingagqibekanga zokuseta amaxabiso aqhelekileyo. Nazi ezona zisetyenziswa kakhulu.
Imixube yabathengisi yimixube yokunceda ukuxhasa izikhangeli ezininzi ngokubandakanya zonke izimaphambili zabathengisi ezifanelekileyo kwiCSS yakho ehlanganisiweyo.
Seta kwakhona imodeli yebhokisi yezixhobo zakho ngomxube omnye. Ngomxholo, jonga eli nqaku eliluncedo elivela kwi-Mozilla .
I -mixin ihoxisiwe njenge- v3.2.0 , kunye nokuqaliswa kwe-Autoprefixer. Ukugcina umva-ukuhambelana, iBootstrap iya kuqhubeka nokusebenzisa i-mixin ngaphakathi de iBootstrap v4.
Namhlanje zonke iibrowser zale mihla zixhasa ipropathi engena-prefixed border-radius
. Ngokunjalo, akukho .border-radius()
mixin, kodwa iBootstrap ibandakanya iindlela ezimfutshane zokurhangqa iikona ezimbini kwicala elithile lento.
Ukuba abaphulaphuli bakho abajolise kubo basebenzisa iibhrawuza zamva nje nezibalaseleyo kunye nezixhobo, qiniseka ukuba usebenzisa box-shadow
ipropathi yodwa. Ukuba ufuna inkxaso ye-Android endala (i-pre-v4) kunye nezixhobo ze-iOS (i-pre-iOS 5), sebenzisa i- mixin eyehliweyo ukuze uthabathe -webkit
isimaphambili esifunekayo.
I-mixin ihoxisiwe njenge-v3.1.0, ekubeni i-Bootstrap ayixhasi ngokusemthethweni iiplatifomu eziphelelwe yisikhathi ezingaxhasi ipropati eqhelekileyo. Ukugcina umva-ukuhambelana, iBootstrap iya kuqhubeka nokusebenzisa i-mixin ngaphakathi de iBootstrap v4.
Qiniseka ukuba usebenzisa rgba()
imibala kwizithunzi zebhokisi yakho ukuze idibane ngokungenamthungo kangangoko kunye nemvelaphi.
Imixube emininzi yokuguquguquka. Seta lonke ulwazi lotshintsho ngenye, okanye uchaze ukulibaziseka okwahlukileyo kunye nobude bexesha njengoko kufuneka.
I - mixins iyancipha njenge-v3.2.0, kunye nokwaziswa kwe-Autoprefixer. Ukugcina umva-ukuhambelana, iBootstrap iya kuqhubeka nokusebenzisa imixube ngaphakathi de iBootstrap v4.
Jikelezisa, sikali, tolika (shenxa), okanye ujike nayiphi na into.
I - mixins iyancipha njenge-v3.2.0, kunye nokwaziswa kwe-Autoprefixer. Ukugcina umva-ukuhambelana, iBootstrap iya kuqhubeka nokusebenzisa imixube ngaphakathi de iBootstrap v4.
Umxube omnye wokusebenzisa zonke iipropati zoopopayi ze-CSS3 kwisibhengezo esinye kunye neminye imixube yeepropati zomntu ngamnye.
I - mixins iyancipha njenge-v3.2.0, kunye nokwaziswa kwe-Autoprefixer. Ukugcina umva-ukuhambelana, iBootstrap iya kuqhubeka nokusebenzisa imixube ngaphakathi de iBootstrap v4.
Cwangcisa ukungafihli kuzo zonke iibhrawuza kwaye unike filter
umva we-IE8.
Nika umxholo wolawulo lwefom ngaphakathi kwendawo nganye.
Yenza iikholamu ngeCSS ngaphakathi kwendawo enye.
Jika ngokulula nayiphi na imibala emibini ibe yigradient yangasemva. Fumana phambili ngakumbi kwaye usete isalathiso, sebenzisa imibala emithathu, okanye sebenzisa i-radial gradient. Ngomxube omnye ufumana zonke ii-syntaxes ezimiselweyo oza kuzifuna.
Ungakhankanya kwakhona i-engile yomgangatho wemibala emibini, umyinge womgama:
Ukuba ufuna isitayile somgca we-barber-stripe, kulula loo nto, nayo. Cacisa nje umbala omnye kwaye siya kwaleka ngomgca omhlophe okhanyayo.
Phakamisa i-ante kwaye usebenzise imibala emithathu endaweni yoko. Cwangcisa umbala wokuqala, umbala wesibini, umbala wesibini wokuyeka (ixabiso lepesenti elifana ne-25%), kunye nombala wesithathu ngale mixube:
Iintloko phezulu! Ukuba ufuna ukususa i-gradient, qiniseka ukuba uyayisusa nayiphi na i-IE-specific filter
onokuthi wongezile. Unokwenza oko ngokusebenzisa i- .reset-filter()
mixin ecaleni background-image: none;
.
Imixube ye-Utility yimixube edibanisa ezinye iipropati ze-CSS ezingahambelaniyo ukufezekisa injongo ethile okanye umsebenzi.
Ulibale ukongeza class="clearfix"
kuyo nayiphi na into kwaye endaweni yoko wongeza .clearfix()
umxube apho kufanelekileyo. Usebenzisa i- micro clearfix evela kuNicolas Gallagher .
Khawuleza uzinzise nayiphi na into ngaphakathi komzali wayo. Ifuna width
okanye max-width
imiselwe.
Chaza imilinganiselo yento ngokulula ngakumbi.
Lungisa ngokulula iinketho zohlengahlengiso kuyo nayiphi na i-textarea, okanye nayiphi na enye into. Ukungagqibeki kwindlela yokuziphatha eqhelekileyo yesikhangeli ( both
).
Uphungula ngokulula umbhalo ngeellipsis ngomxube omnye. Ifuna into ukuba ibe block
okanye inline-block
inqanaba.
Chaza iindlela ezimbini zemifanekiso kunye nomlinganiselo we-@1x womfanekiso, kwaye i-Bootstrap iya kubonelela ngombuzo we-@2x wemidiya. Ukuba unemifanekiso emininzi onokuyisebenzisa, cinga ngokubhala umfanekiso wakho weretina CSS ngesandla kumbuzo omnye wemidiya.
Ngelixa i-Bootstrap yakhelwe kwi-Ngancinci, ikwanayo ne- Sass port esemthethweni . Siyigcina kwindawo eyahlukileyo yeGitHub kwaye siphatha uhlaziyo ngeskripthi sokuguqula.
Kuba izibuko le-Sass linerepo eyahlukileyo kwaye isebenzela abaphulaphuli abahluke kancinane, imixholo yeprojekthi yahluke kakhulu kwiprojekthi yeBootstrap. Oku kuqinisekisa ukuba izibuko le-Sass liyahambelana neenkqubo ezininzi ezisekelwe kwi-Sass kangangoko kunokwenzeka.
Indlela | Inkcazo |
---|---|
lib/ |
Ikhowudi yegem yeRuby (ubumbeko lweSass, iiRail kunye neCompass indibaniselwano) |
tasks/ |
Izikripthi zokuguqula (ujika umsinga unyuke kancinci ukuya kwiSass) |
test/ |
Iimvavanyo zokuhlanganisa |
templates/ |
Umboniso wepakethe yeCompass |
vendor/assets/ |
Sass, JavaScript, kunye neefayile zefonti |
Rakefile |
Imisebenzi yangaphakathi, efana neraki kunye nokuguqula |
Ndwendwela indawo yokugcina ye-GitHub ye-Sass ukuze ubone ezi fayile zisebenza.
Ngolwazi malunga nendlela yokufaka nokusebenzisa i-Bootstrap ye-Sass, jonga kwindawo yokugcina i- GitHub readme . Ngowona mthombo uhlaziyiweyo kwaye uquka ulwazi olunokusetyenziswa nooLoliwe, iCompass, kunye neeprojekthi ezisemgangathweni zeSass.