CSS
Izilungiselelo ze-Global CSS, izakhi ze-HTML ezibalulekile zenziwe isitayela futhi zathuthukiswa ngamakilasi andayo, kanye nesistimu yegridi ethuthukisiwe.
Izilungiselelo ze-Global CSS, izakhi ze-HTML ezibalulekile zenziwe isitayela futhi zathuthukiswa ngamakilasi andayo, kanye nesistimu yegridi ethuthukisiwe.
Thola ukwehla kwezingcezu ezibalulekile zengqalasizinda ye-Bootstrap, okuhlanganisa nendlela yethu yokuthuthukiswa kwewebhu okungcono, okusheshayo, okuqinile.
I-Bootstrap isebenzisa izici ezithile ze-HTML kanye nezakhiwo ze-CSS ezidinga ukusetshenziswa kwe-HTML5 doctype. Ifake ekuqaleni kwawo wonke amaphrojekthi akho.
Nge-Bootstrap 2, sengeze izitayela ezinobungane zomakhalekhukhwini ezingakhethwa kuzici ezibalulekile zohlaka. Nge-Bootstrap 3, sibhale kabusha iphrojekthi ukuthi ihambisane neselula kusukela ekuqaleni. Esikhundleni sokwengeza izitayela zeselula ozikhethela zona, zibhakwa khona phakathi. Eqinisweni, i-Bootstrap iselula kuqala . Izitayela zokuqala zamaselula zingatholakala kuwo wonke umtapo wolwazi esikhundleni samafayela ahlukene.
Ukuqinisekisa ukunikezela okulungile nokusondeza ngokuthinta, engeza i-meta tag yembobo yokubuka ku- <head>
.
Ungakhubaza amandla okusondeza kumadivayisi eselula ngokwengeza user-scalable=no
ku-meta tag yembobo yokubuka. Lokhu kukhubaza ukusondeza, okusho ukuthi abasebenzisi bayakwazi ukuskrola kuphela, futhi kuholela ekutheni isayithi lakho lizizwe lifana nohlelo lokusebenza lwendabuko. Sekukonke, asikuncomi lokhu kuwo wonke amasayithi, ngakho-ke qaphela!
I-Bootstrap isetha isibonisi somhlaba jikelele esiyisisekelo, i-typography, nezitayela zokuxhumanisa. Ngokukhethekile, thina:
background-color: #fff;
kubody
@font-family-base
, @font-size-base
, kanye @line-height-base
nezibaluli njengesisekelo sethu se-typographic@link-color
futhi usebenzise isixhumanisi esidwebelayo kuphela:hover
Lezi zitayela zingatholakala ngaphakathi scaffolding.less
.
Ukuze uthole ukunikezwa okuthuthukisiwe kwesiphequluli, sisebenzisa i - Normalize.css , iphrojekthi ka- Nicolas Gallagher kanye no- Jonathan Neal .
I-Bootstrap idinga into equkethe ukusonga okuqukethwe kwesayithi nokufaka isistimu yethu yegridi. Ungakhetha esinye seziqukathi ezimbili ongazisebenzisa kumaphrojekthi akho. Qaphela ukuthi, ngenxa padding
nokunye okwengeziwe, asikho isiqukathi esidleka.
Sebenzisa .container
okwesitsha esisabelayo esinobubanzi obugxilile.
Sebenzisa .container-fluid
isiqukathi esinobubanzi obugcwele, esihlanganisa bonke ububanzi bembobo yokubuka yakho.
I-Bootstrap ihlanganisa isistimu ephendulayo, yeselula yokuqala ewuketshezi ekala ngokufanelekile kufika kumakholomu angu-12 njengoba idivayisi noma usayizi wembobo yokubuka ukhula. Kuhlanganisa amakilasi achazwe ngaphambilini ukuze uthole izinketho ezilula zesakhiwo, kanye nezingxube ezinamandla zokukhiqiza izakhiwo ze-semantic ezengeziwe .
Amasistimu egridi asetshenziselwa ukudala izakhiwo zekhasi ngochungechunge lwemigqa namakholomu agcina okuqukethwe kwakho. Nansi indlela isistimu yegridi ye-Bootstrap esebenza ngayo:
.container
(ububanzi obulungisiwe) noma .container-fluid
(ububanzi obugcwele) ukuze kumiswe ngendlela efanele kanye nokugxunyekwa..row
futhi .col-xs-4
ayatholakala ukuze kwenziwe ngokushesha izakhiwo zegridi. Amamiksi amancane nawo angasetshenziswa ekwakhiweni okwengeziwe kwe-semantic.padding
. Lokho kuphedi kususwa emigqeni yekholomu yokuqala neyokugcina kusetshenziswa imajini eyinegethivu ku- .row
s..col-xs-4
..col-md-*
isigaba kusici ngeke kuthinte kuphela isitayela saso kumadivayisi aphakathi nendawo kodwa nakumadivayisi amakhulu uma .col-lg-*
ikilasi lingekho.Bheka izibonelo zokusebenzisa lezi zimiso kukhodi yakho.
Sisebenzisa imibuzo yemidiya elandelayo kumafayela ethu Amancane ukuze sakhe izindawo zokunqamuka eziyinhloko kusistimu yethu yegridi.
Kwesinye isikhathi sinweba kule mibuzo yemidiya ukuze ifake i- max-width
CSS yokukhawulela kusethi emincane yamadivayisi.
Bona ukuthi izici zesistimu yegridi ye-Bootstrap zisebenza kanjani kuwo wonke amadivayisi anetafula eliwusizo.
Amadivayisi amancane angeziwe Amafoni (<768px) | Amathebulethi Amadivayisi Amancane (≥768px) | Amadeskithophu wedivayisi amaphakathi (≥992px) | Amadeskithophu amakhulu wamadivayisi (≥1200px) | |
---|---|---|---|---|
Ukuziphatha kwegridi | Ivundlile ngaso sonke isikhathi | Igoqwe ukuze kuqale, evundlile ngenhla kwama-breakpoint | ||
Ububanzi besiqukathi | Lutho (okuzenzakalelayo) | 750px | 970px | 1170px |
Isiqalo sekilasi | .col-xs- |
.col-sm- |
.col-md- |
.col-lg- |
# wamakholomu | 12 | |||
Ububanzi bekholomu | Okuzenzakalelayo | ~62px | ~81px | ~97px |
Ububanzi be-Gutter | 30px (15px ohlangothini ngalunye lwekholomu) | |||
I-Nestable | Yebo | |||
Ama-Offsets | Yebo | |||
Ukuhleleka kwekholomu | Yebo |
Usebenzisa isethi eyodwa .col-md-*
yamakilasi egridi, ungakha isistimu yegridi eyisisekelo eqala ngokunqwabelaniswa kumadivayisi eselula nakumadivayisi ethebhulethi (ububanzi obuncane kakhulu ukuya kwabancane) ngaphambi kokuba ibe evundlile kumadivayisi edeskithophu (amaphakathi). Beka amakholomu egridi kunoma iyiphi .row
.
Guqula noma yisiphi isakhiwo segridi enobubanzi obugxilile sibe isakhiwo esinobubanzi obugcwele ngokushintsha ingaphandle lakho .container
libe yi- .container-fluid
.
Awufuni ukuthi amakholomu akho avele anqwabelene kumadivayisi amancane? Sebenzisa amakilasi egridi yedivayisi encane namaphakathi ngokwengeza .col-xs-*
.col-md-*
kumakholomu akho. Bheka isibonelo esingezansi ukuze uthole umbono ongcono wokuthi konke kusebenza kanjani.
Yakha esibonelweni sangaphambilini ngokudala izakhiwo eziguqukayo nezinamandla kakhulu .col-sm-*
ngamakilasi ethebhulethi.
Uma amakholomu angaphezu kuka-12 ebekwe phakathi komugqa owodwa, iqembu ngalinye lamakholomu engeziwe, njengeyunithi eyodwa, lizogoqa emugqeni omusha.
Njengoba kunezigaba ezine zamagridi ezitholakalayo uzobhekana nezinkinga lapho, ezindaweni ezithile zokunqamuka, amakholomu akho angacaci kahle njengoba eyodwa iyinde kunenye. Ukuze ulungise lokho, sebenzisa inhlanganisela ye-a .clearfix
kanye nezigaba zethu zosizo eziphendulayo .
Ngokungeziwe ekususeni amakholomu ezindaweni ezisabelayo, ungase udinge ukusetha kabusha ama-offset, ama-push, noma ama-donsa . Bona lokhu kusebenza esibonelweni segridi .
Hambisa amakholomu kwesokudla usebenzisa .col-md-offset-*
amakilasi. Lezi zigaba zandisa umkhawulo wesokunxele wekholomu *
ngamakholomu. Isibonelo, .col-md-offset-4
ihamba .col-md-4
phezu kwamakholomu amane.
Ungaphinda ubhale ngaphezulu ama-offsets asuka kuma-grid tiers aphansi .col-*-offset-0
ngamakilasi.
Ukuze uhlanganise okuqukethwe kwakho ngegridi ezenzakalelayo, engeza entsha .row
nesethi .col-sm-*
yamakholomu ngaphakathi kwekholomu ekhona .col-sm-*
. Imigqa efakwe kusidleke kufanele ifake isethi yamakholomu ahlanganisa kufika ku-12 noma ngaphansi (akudingekile ukuthi usebenzise wonke amakholomu angu-12 atholakalayo).
Shintsha kalula ukuhleleka kwamakholomu ethu egridi akhelwe ngaphakathi .col-md-push-*
ngamakilasi .col-md-pull-*
okulungisa.
Ngokungeziwe kumakilasi egridi akhiwe kusengaphambili ezakhiwo ezisheshayo, i-Bootstrap ihlanganisa okuguquguqukayo Okuncane nezingxube zokukhiqiza ngokushesha izakhiwo zakho ezilula, ze-semantic.
Okuguquguqukayo kunquma inani lamakholomu, ububanzi be-gutter, kanye nendawo yombuzo wemidiya okufanele kuqalwe kuyo amakholomu antantayo. Sisebenzisa lezi ukuze sikhiqize amakilasi egridi achazwe ngaphambilini abhalwe ngenhla, kanye nezingxube zangokwezifiso ezibalwe ngezansi.
Imiksi isetshenziswa ngokuhambisana neziguquko zegridi ukuze kukhiqizwe i-CSS ye-semantic yamakholomu egridi ngayinye.
Ungakwazi ukuguqula okuguquguqukayo kube ngamavelu akho angokwezifiso, noma usebenzise nje ama-mixins ngamavelu awo azenzakalelayo. Nasi isibonelo sokusebenzisa izilungiselelo ezizenzakalelayo ukuze udale isakhiwo samakholomu amabili esinegebe phakathi.
Zonke izihloko ze-HTML, <h1>
ukuya ku- <h6>
, ziyatholakala. .h1
ngamakilasi .h6
nawo ayatholakala, uma ufuna ukufanisa isitayela sefonti yesihloko kodwa usafuna ukuthi umbhalo wakho uboniswe emgqeni.
h1. Isihloko se-Bootstrap |
I-Semibold 36px |
h2. Isihloko se-Bootstrap |
I-Semibold 30px |
h3. Isihloko se-Bootstrap |
I-Semibold 24px |
h4. Isihloko se-Bootstrap |
I-Semibold 18px |
h5. Isihloko se-Bootstrap |
I-Semibold 14px |
h6. Isihloko se-Bootstrap |
I-semibold engu-12px |
Dala umbhalo olula, wesibili kunoma isiphi isihloko onomaka ojwayelekile <small>
noma .small
ikilasi.
h1. Isihloko se-Bootstrap Umbhalo wesibili |
h2. Isihloko se-Bootstrap Umbhalo wesibili |
h3. Isihloko se-Bootstrap Umbhalo wesibili |
h4. Isihloko se-Bootstrap Umbhalo wesibili |
h5. Isihloko se-Bootstrap Umbhalo wesibili |
h6. Isihloko se-Bootstrap Umbhalo wesibili |
Okuzenzakalelayo komhlaba wonke kwe-Bootstrap font-size
kungu- 14px , ene line-height
- 1.428 . Lokhu kusetshenziswe kuzo <body>
zonke izigaba. Ngaphezu kwalokho, <p>
(izigaba) zithola imajini engezansi yohhafu ubude bomugqa womugqa ohlanganisiwe (10px ngokuzenzakalelayo).
I-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. I-Donec ullamcorper nulla non metus auctor fringilla. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. I-Donec 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 isigaba sigqame ngokungeza .lead
.
I-Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. I-Duis mollis, ayiyona i-commodo luctus.
Isilinganiso se-typographic sisekelwe kokuhlukahluka okubili Okuncane kokuguquguqukayo.kancane : @font-size-base
kanye @line-height-base
. Esokuqala siwusayizi wefonti eyisisekelo osetshenziswa kuyo yonke indawo kanti eyesibili ubude bomugqa oyisisekelo. Sisebenzisa lezo ziguquguqukayo kanye nezibalo ezithile ezilula ukuze sakhe amamajini, ama-paddings, nobude bomugqa balo lonke uhlobo lwethu nokunye. Enze ngendlela oyifisayo kanye nezimo ze-Bootstrap.
Ukuze ugqamise ukugijima kombhalo ngenxa yokuhambisana kwawo komunye umongo, sebenzisa <mark>
umaka.
Ungasebenzisa umaki wokumaka ukuzegqamisaumbhalo.
Ukuze ubonise amabhlogo ombhalo asusiwe sebenzisa <del>
ithegi.
Lo mugqa wombhalo uhloselwe ukuthathwa njengombhalo osusiwe.
Ukuze ubonise amabhlogo ombhalo angasabalulekile sebenzisa <s>
ithegi.
Lo mugqa wombhalo uhloselwe ukuthi uthathwe njengongasanembile.
Ukuze ubonise izengezo kudokhumenti sebenzisa <ins>
ithegi.
Lo mugqa wombhalo uhloselwe ukuthi uthathwe njengesengezo kudokhumenti.
Ukudwebela umbhalo sebenzisa <u>
ithegi.
Lo mugqa wombhalo uzosebenza njengokudwetshelwe
Sebenzisa omaka bokugcizelela be-HTML abazenzakalelayo abanezitayela ezingasindi.
Ukuze ungagcizeleli emgqeni noma emabhuloki wombhalo, sebenzisa <small>
umaka ukuze usethe umbhalo kusayizi ongu-85% womzali. Ama-elementi esihloko athola font-size
okwawo kuma-elementi afakwe isidleke <small>
.
Okunye ungasebenzisa i-elementi esemgqeni .small
esikhundleni sanoma iyiphi <small>
.
Lo mugqa wombhalo uhloselwe ukuthathwa njengokuphrinta kahle.
Ukuze ugcizelele amazwibela ombhalo onesisindo sefonti esindayo.
Amazwibela alandelayo ombhalo ahunyushwa njengombhalo ogqamile .
Ukuze ugcizelele amazwibela ombhalo omalukeke.
Amazwibela alandelayo ombhalo ahunyushwa njengombhalo omalukeke .
Zizwe ukhululekile ukusebenzisa <b>
futhi <i>
ku-HTML5. <b>
ihloselwe ukugqamisa amagama noma imishwana ngaphandle kokudlulisa ukubaluleka okwengeziwe kuyilapho <i>
ngokuvamile kungokwezwi, amagama obuchwepheshe, njll.
Hlela kabusha umbhalo kalula ube izingxenye ezinamakilasi okuqondanisa umbhalo.
Umbhalo oqondaniswe kwesokunxele.
Umbhalo oqondaniswe namaphakathi.
Umbhalo oqondaniswe kwesokudla.
Umbhalo olungisiwe.
Awukho umbhalo wokugoqa.
Guqula umbhalo ube izingxenye ngamakilasi osonhlamvukazi bombhalo.
Umbhalo onezinhlamvu eziphansi.
Umbhalo onezinhlamvu ezinkulu.
Umbhalo obhalwe ngosonhlamvukazi.
Ukuqaliswa okunesitayela kwe- <abbr>
elementi ye-HTML yezifinyezo nama-akhronimi ukuze kuboniswe inguqulo enwetshiwe kukuhambisa phezulu. Izifinyezo ezinesibaluli title
zinomngcele ongezansi onamachashazi akhanyayo kanye nekhesa yosizo ekuhambiseni phezulu, okuhlinzeka ngomongo owengeziwe ekuhambiseni phezulu kanye nakubasebenzisi bobuchwepheshe obusizayo.
Isifinyezo segama lesichasiso sithi attr .
Engeza .initialism
kusifinyezo sosayizi wefonti omncane kancane.
I- HTML iyinto engcono kakhulu kusukela kusinkwa esisikiwe.
Yethula imininingwane yokuxhumana yedlozi eliseduze noma wonke umsebenzi. Londoloza ukufometha ngokuqeda yonke imigqa nge- <br>
.
Ngokucaphuna amabhlogo wokuqukethwe komunye umthombo ngaphakathi kwedokhumenti yakho.
Goqa <blockquote>
noma iyiphi i- HTML njengengcaphuno. Ukuze uthole izingcaphuno eziqondile, sincoma a <p>
.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. I-integer posuere ilingana ne-ante.
Isitayela nokuqukethwe kuyashintsha ukuze kube nokuhlukahluka okulula kokujwayelekile <blockquote>
.
Engeza u-a <footer>
ukuze uthole umthombo. Gcoba igama lomsebenzi womthombo ngesi- <cite>
.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. I-integer posuere ilingana ne-ante.
Engeza .blockquote-reverse
i-blockquote enokuqukethwe okuqondaniswe kwesokudla.
Uhlu lwezinto lapho i-oda lingenandaba khona ngokusobala.
Uhlu lwezinto lapho i-oda libaluleke ngokusobala.
Susa list-style
imajini ezenzakalelayo nengakwesokunxele ezintweni zohlu (izingane eziseduze kuphela). Lokhu kusebenza kuphela ezintweni ezisheshayo zohlu lwezingane , okusho ukuthi uzodinga ukungeza ikilasi kunoma yiluphi uhlu olufakwe esidlekeni.
Beka zonke izinto zohlu emugqeni owodwa display: inline-block;
onamaphedi alula.
Uhlu lwamagama anezincazelo ezihambisana nawo.
Yenza imigomo nezincazelo <dl>
zilandelane. Iqala isitakikhi njengo- <dl>
s okuzenzakalelayo, kodwa uma ibha ye-navbar ikhula, yenza kanjalo nalokhu.
Uhlu lwezincazelo ezivundlile luzonciphisa amagama amade kakhulu ukuthi angangena kukholamu yesokunxele ngokuthi text-overflow
. Ezingobeni zokubuka ezinciphile, zizoshintshela kusakhiwo esistakiwe esizenzakalelayo.
Goqa amazwibela ekhodi nge- <code>
.
<section>
kufanele isongwe njenge-inline.
Sebenzisa <kbd>
ukukhombisa okokufaka okuvamise ukufakwa ngekhibhodi.
Sebenzisa <pre>
emigqeni eminingi yekhodi. Qiniseka ukuthi ubalekela noma yibaphi abakaki be-engeli kukhodi ukuze unikezwe ngendlela efanele.
<p>Isampula yombhalo lapha...</p>
Ungakhetha ngokukhetha .pre-scrollable
iklasi, elizosetha ubude bobude obungu-350px futhi linikeze ibha yokuskrola ye-y-axis.
Ukuze ubonise okuguquguqukayo sebenzisa <var>
ithegi.
y = m x + b
Ukuze ubonise ukuphuma kwesampula yamabhulokhi kuhlelo sebenzisa <samp>
ithegi.
Lo mbhalo uhloselwe ukuthi uthathwe njengesampula ephuma ohlelweni lwekhompyutha.
Ukuze uthole isitayela esiyisisekelo—i-padding ekhanyayo nezihlukanisi ezivundlile kuphela—engeza isigaba sesisekelo .table
kunoma iyiphi <table>
. Kungase kubonakale kungenasidingo kakhulu, kodwa uma kubhekwa ukusetshenziswa kabanzi kwamathebula kwamanye ama-plugin afana namakhalenda nezikhethi zezinsuku, sikhethe ukuhlukanisa izitayela zethu zetafula ngokwezifiso.
# | Igama | Isibongo | Igama lomsebenzisi |
---|---|---|---|
1 | Maka | Otto | @mdo |
2 | uJakobe | Thornton | @amafutha |
3 | Larry | uNyoni |
Sebenzisa .table-striped
ukwengeza i-zebra-striping kunoma yimuphi umugqa wethebula ngaphakathi kwe- <tbody>
.
Amathebula anemigqa enziwe isitayela ngesikhethi se- :nth-child
CSS, esingatholakali ku-Internet Explorer 8.
# | Igama | Isibongo | Igama lomsebenzisi |
---|---|---|---|
1 | Maka | Otto | @mdo |
2 | uJakobe | Thornton | @amafutha |
3 | Larry | uNyoni |
Engeza .table-bordered
imingcele kuzo zonke izinhlangothi zetafula namaseli.
# | Igama | Isibongo | Igama lomsebenzisi |
---|---|---|---|
1 | Maka | Otto | @mdo |
2 | uJakobe | Thornton | @amafutha |
3 | Larry | uNyoni |
Engeza .table-hover
ukuze unike amandla isimo sokuhambisa phezulu emigqeni yethebula ngaphakathi kwe- <tbody>
.
# | Igama | Isibongo | Igama lomsebenzisi |
---|---|---|---|
1 | Maka | Otto | @mdo |
2 | uJakobe | Thornton | @amafutha |
3 | Larry | uNyoni |
Engeza .table-condensed
ukuze wenze amatafula ahlangane kakhudlwana ngokusika ama-cell padding phakathi.
# | Igama | Isibongo | Igama lomsebenzisi |
---|---|---|---|
1 | Maka | Otto | @mdo |
2 | uJakobe | Thornton | @amafutha |
3 | Larry Inyoni |
Sebenzisa amakilasi anomongo ukuze ufake imibala yemigqa yethebula noma amaseli ngamanye.
Ikilasi | Incazelo |
---|---|
.active |
Ifaka umbala ohambisa phezulu kumugqa othile noma iseli |
.success |
Ibonisa isenzo esiyimpumelelo noma esihle |
.info |
Ibonisa ushintsho olunolwazi olungathathi hlangothi noma isenzo |
.warning |
Ikhombisa isexwayiso esingase sidinge ukunakwa |
.danger |
Ibonisa isenzo esiyingozi noma okungenzeka sibe sibi |
# | Isihloko sekholomu | Isihloko sekholomu | Isihloko sekholomu |
---|---|---|---|
1 | Okuqukethwe kwekholomu | Okuqukethwe kwekholomu | Okuqukethwe kwekholomu |
2 | Okuqukethwe kwekholomu | Okuqukethwe kwekholomu | Okuqukethwe kwekholomu |
3 | Okuqukethwe kwekholomu | Okuqukethwe kwekholomu | Okuqukethwe kwekholomu |
4 | Okuqukethwe kwekholomu | Okuqukethwe kwekholomu | Okuqukethwe kwekholomu |
5 | Okuqukethwe kwekholomu | Okuqukethwe kwekholomu | Okuqukethwe kwekholomu |
6 | Okuqukethwe kwekholomu | Okuqukethwe kwekholomu | Okuqukethwe kwekholomu |
7 | Okuqukethwe kwekholomu | Okuqukethwe kwekholomu | Okuqukethwe kwekholomu |
8 | Okuqukethwe kwekholomu | Okuqukethwe kwekholomu | Okuqukethwe kwekholomu |
9 | Okuqukethwe kwekholomu | Okuqukethwe kwekholomu | Okuqukethwe kwekholomu |
Ukusebenzisa umbala ukwengeza incazelo kumugqa wethebula noma iseli ngalinye kunikeza kuphela inkomba ebonakalayo, engeke idluliselwe kubasebenzisi bobuchwepheshe obusizayo - njengezifundi zesikrini. Qinisekisa ukuthi ulwazi olushiwo umbala lusobala kokuqukethwe ngokwako (umbhalo obonakalayo kumugqa/iseli yethebula efanele), noma ufakiwe ngezinye izindlela, njengombhalo owengeziwe ofihliwe .sr-only
nekilasi.
Dala amathebula asabelayo ngokugoqa noma yimaphi .table
ukuze .table-responsive
uwenze apheqe avundlile kumadivayisi amancane (ngaphansi kuka-768px). Uma ubuka kunoma yini enkulu kuno-768px ububanzi, ngeke ubone umehluko kulawa mathebula.
Amathebula aphendulayo asebenzisa overflow-y: hidden
okuthi , okusika noma yikuphi okuqukethwe okudlulela ngale kwangaphansi noma imiphetho ephezulu yethebula. Ikakhulukazi, lokhu kunganqamula amamenyu okwehlayo namanye amawijethi ezinkampani zangaphandle.
IFirefox inesitayela sesethi yasensimini esingesihle esibandakanya width
esiphazamisa ithebula eliphendulayo. Lokhu akukwazi ukukhishwa ngaphandle kokugebenga okuqondile kweFirefox esingakuhlinzeki ku -Bootstrap:
Ukuze uthole ulwazi olwengeziwe, funda le mpendulo yokuchichima kwesitaki .
# | Isihloko sethebula | Isihloko sethebula | Isihloko sethebula | Isihloko sethebula | Isihloko sethebula | Isihloko sethebula |
---|---|---|---|---|---|---|
1 | Iseli yethebula | Iseli yethebula | Iseli yethebula | Iseli yethebula | Iseli yethebula | Iseli yethebula |
2 | Iseli yethebula | Iseli yethebula | Iseli yethebula | Iseli yethebula | Iseli yethebula | Iseli yethebula |
3 | Iseli yethebula | Iseli yethebula | Iseli yethebula | Iseli yethebula | Iseli yethebula | Iseli yethebula |
# | Isihloko sethebula | Isihloko sethebula | Isihloko sethebula | Isihloko sethebula | Isihloko sethebula | Isihloko sethebula |
---|---|---|---|---|---|---|
1 | Iseli yethebula | Iseli yethebula | Iseli yethebula | Iseli yethebula | Iseli yethebula | Iseli yethebula |
2 | Iseli yethebula | Iseli yethebula | Iseli yethebula | Iseli yethebula | Iseli yethebula | Iseli yethebula |
3 | Iseli yethebula | Iseli yethebula | Iseli yethebula | Iseli yethebula | Iseli yethebula | Iseli yethebula |
Izilawuli zefomu ngazinye zithola ngokuzenzakalelayo isitayela esithile somhlaba wonke. Yonke imibhalo <input>
, <textarea>
, kanye <select>
nezakhi ezinazo .form-control
zisethwa width: 100%;
ngokuzenzakalelayo. Goqa amalebula nezilawuli .form-group
ukuze uthole isikhala esiphezulu.
Ungahlanganisi amaqembu efomu ngqo namaqembu okokufaka . Esikhundleni salokho, misa iqembu lokokufaka ngaphakathi kweqembu lefomu.
Engeza .form-inline
efomini lakho (okungadingeki kube a <form>
) ukuze uthole izilawuli eziqondaniswe kwesokunxele kanye ne-inline-block. Lokhu kusebenza kuphela kumafomu angaphakathi kwezindawo zokubuka ezinobubanzi okungenani obungu-768px.
Okokufaka nokukhethiwe width: 100%;
kusetshenziswe ngokuzenzakalelayo ku-Bootstrap. Ngaphakathi kwamafomu asemgqeni, sisetha kabusha lokho width: auto;
kuzilawuli eziningi ukuze zihlale emugqeni ofanayo. Kuye ngesakhiwo sakho, ububanzi bangokwezifiso obungeziwe bungase budingeke.
Izifundi zesikrini zizoba nenkinga ngamafomu akho uma ungafaki ilebula yakho konke okokufaka. Kulawa mafomu asemgqeni, ungafihla amalebula usebenzisa .sr-only
ikilasi. Kukhona ezinye izindlela zokuhlinzeka ngelebula lobuchwepheshe obusizayo, obufana ne- aria-label
, aria-labelledby
noma title
isibaluli. Uma kungekho kulokhu okukhona, abafundi besikrini bangaphendukela ekusebenziseni placeholder
isibaluli, uma sikhona, kodwa qaphela ukuthi ukusetshenziswa placeholder
njengokumiselela ezinye izindlela zokulebula akwelulekwa.
Sebenzisa amakilasi egridi achazwe ngaphambilini e-Bootstrap ukuze uqondanise amalebula namaqembu ezilawuli zefomu ngesakhiwo esivundlile ngokwengeza .form-horizontal
efomini (okungadingeki libe yi- <form>
). Ukwenza kanjalo kushintsha .form-group
s ukuziphatha njengemigqa yegridi, ngakho-ke asikho isidingo se- .row
.
Izibonelo zezilawuli zefomu ezijwayelekile ezisekelwa kusakhiwo sefomu lesibonelo.
Ukulawulwa kwefomu okuvame kakhulu, izinkambu zokufaka ezisuselwe embhalweni. Kufaka usekelo lwazo zonke izinhlobo ze-HTML5: text
, password
, datetime
, datetime-local
, date
, month
, time
, week
, number
, email
, url
, search
, tel
, kanye color
.
Okufakwayo kuzokwenziwa isitayela ngokugcwele kuphela uma type
kumenyezelwe kahle.
Ukwengeza umbhalo ohlanganisiwe noma izinkinobho ngaphambi kanye/noma ngemva kwanoma yimuphi umbhalo osuselwe <input>
, hlola ingxenye yeqembu lokufaka .
Ukulawula kwefomu okusekela imigqa eminingi yombhalo. Shintsha rows
isibaluli njengoba kudingeka.
Amabhokisi okuhlola awokukhetha inketho eyodwa noma ezimbalwa ohlwini, kuyilapho imisakazo ingeyokukhetha inketho eyodwa kweziningi.
Amabhokisi okuhlola akhubazekile namarediyo asekelwe, kodwa ukuze unikeze ikhesa "engavunyelwe" ekuhambeni komzali <label>
, uzodinga ukungeza .disabled
iklasi kumzali .radio
, .radio-inline
, .checkbox
, noma .checkbox-inline
.
Sebenzisa i- .checkbox-inline
noma .radio-inline
amakilasi ochungechungeni lwamabhokisi okuhlola noma imisakazo ngezilawuli ezivela emugqeni ofanayo.
Uma ungenawo umbhalo ngaphakathi kwe- <label>
, okokufaka kumiswa ngendlela obungayilindela. Okwamanje isebenza kuphela kumabhokisi okuhlola angekho ku-inthanethi nemisakazo. Khumbula ukuthi usanikeze uhlobo oluthile lwelebula lobuchwepheshe obusizayo (ngokwesibonelo, ukusebenzisa aria-label
).
Qaphela ukuthi amamenyu amaningi omdabu akhethiwe—okuyi-Safari ne-Chrome—anamakhona ayindingilizi angakwazi ukuguqulwa border-radius
ngezinto.
Ezilawulweni <select>
ezinesibaluli multiple
, izinketho eziningi ziboniswa ngokuzenzakalelayo.
Uma udinga ukubeka umbhalo ongenalutho eduze kwelebula yefomu ngaphakathi kwefomu, sebenzisa .form-control-static
ikilasi ku- <p>
.
Sisusa izitayela ezizenzakalelayo outline
kwezinye izilawuli zefomu futhi sisebenzise u-a box-shadow
endaweni yazo :focus
.
:focus
sedemoIsibonelo esingenhla sisebenzisa izitayela zangokwezifiso kumadokhumenti ethu ukubonisa :focus
isimo ku- .form-control
.
Engeza disabled
isibaluli se-boolean kokokufaka ukuze uvimbele ukusebenzisana komsebenzisi. Okokufaka okukhubazekile kubonakala kulula futhi kwengeza not-allowed
ikhesa.
Engeza disabled
isibaluli kokuthi a <fieldset>
ukuze ukhubaze zonke izilawuli ngaphakathi <fieldset>
ngesikhathi esisodwa.
<a>
Ngokuzenzakalela, iziphequluli zizophatha zonke izilawuli zefomu lomdabu ( <input>
, <select>
nezici <button>
) ngaphakathi <fieldset disabled>
njengokukhutshaziwe, ukuvimbela kokubili ukusebenzisana kwekhibhodi negundane kuzo. Kodwa-ke, uma ifomu lakho lihlanganisa <a ... class="btn btn-*">
nezakhi, lezi zizonikezwa kuphela isitayela se- pointer-events: none
. Njengoba kuphawuliwe esigabeni esimayelana nezinkinobho ezikhubaziwe (futhi ikakhulukazi esigatshaneni sezinto zokuhlanganisa ihange), lesi sakhiwo se-CSS asikakamiswa futhi asisekelwe ngokugcwele ku-Opera 18 nangaphansi, noma ku-Internet Explorer 11, futhi iwiniwe. vimbela abasebenzisi bekhibhodi ukuthi bangakwazi ukugxila noma ukwenza lezi zixhumanisi zisebenze. Ngakho ukuze uphephe, sebenzisa i-JavaScript yangokwezifiso ukuze ukhubaze izixhumanisi ezinjalo.
Nakuba i-Bootstrap izosebenzisa lezi zitayela kuzo zonke iziphequluli, i-Internet Explorer 11 nangaphansi ayisekeli ngokugcwele disabled
isici ku- <fieldset>
. Sebenzisa i-JavaScript yangokwezifiso ukuze ukhubaze isethi yasensimini kulezi ziphequluli.
Engeza readonly
isibaluli se-boolean kokokufaka ukuze uvimbele ukuguqulwa kwevelu yokokufaka. Okokufaka kokufunda kuphela kubonakala kulula (njengokokufaka okukhutshaziwe), kodwa gcina ikhesa evamile.
Umbhalo wosizo weleveli yokuvimba ukuze uthole izilawuli zefomu.
Umbhalo wosizo kufanele uhlotshaniswe ngokusobala nokulawula kwefomu ohlobene nokusebenzisa aria-describedby
isibaluli. Lokhu kuzoqinisekisa ukuthi ubuchwepheshe obusizayo - njengezifundi zesikrini - buzomemezela lo mbhalo wosizo lapho umsebenzisi egxile noma engena ekulawuleni.
I-Bootstrap ihlanganisa izitayela zokuqinisekisa zephutha, isexwayiso, kanye nezimo zempumelelo kuzilawuli zefomu. Ukusebenzisa, ukwengeza .has-warning
, .has-error
, noma .has-success
into engumzali. Noma iyiphi .control-label
, .form-control
, futhi .help-block
ngaphakathi kwaleyo elementi izothola izitayela zokuqinisekisa.
Ukusebenzisa lezi zitayela zokuqinisekisa ukukhombisa isimo sokulawula kwefomu kunikeza kuphela inkomba ebonakalayo, esekelwe kumbala, engeke idluliselwe kubasebenzisi bobuchwepheshe obusizayo - njengezifundi zesikrini - noma kubasebenzisi abangaboni umbala.
Qinisekisa ukuthi enye inkomba yombuso nayo inikeziwe. Ngokwesibonelo, ungafaka iseluleko mayelana nesimo embhalweni wokulawula wefomu <label>
ngokwawo (njengoba kunjalo esibonelweni sekhodi esilandelayo), faka i- Glyphicon (nombhalo ohlukile ofanele usebenzisa .sr-only
ikilasi - bheka izibonelo ze- Glyphicon ), noma ngokunikeza usizo olwengeziwe block yombhalo . Ngokukhethekile kubuchwepheshe obusizayo, izilawuli zefomu ezingavumelekile nazo zinganikezwa aria-invalid="true"
isibaluli.
Ungakwazi futhi ukwengeza izithonjana zempendulo ozikhethela yona ngokungezwa .has-feedback
kanye nesithonjana esifanele.
Izithonjana zempendulo zisebenza <input class="form-control">
ngezakhi zombhalo kuphela.
Ukuma mathupha kwezithonjana zempendulo kuyadingeka kokokufaka ngaphandle kwelebula nasemaqenjini okokufaka anesengezo kwesokudla. Ukhuthazwa kakhulu ukuthi unikeze amalebula akho konke okokufaka ngezizathu zokufinyeleleka. Uma ufisa ukuvimbela amalebula ukuthi angavezwa, wafihle .sr-only
nekilasi. Uma kufanele wenze ngaphandle kwamalebula, lungisa top
inani lesithonjana sempendulo. Kumaqembu okokufaka, lungisa right
inani libe inani lephikseli elifanele kuye ngobubanzi be-addon yakho.
Ukuqinisekisa ukuthi ubuchwepheshe obusizayo - njengezifundi zesikrini - budlulisela ngendlela efanele incazelo yesithonjana, umbhalo ofihliwe owengeziwe kufanele ufakwe .sr-only
nekilasi futhi uhlotshaniswe ngokusobala nokulawula kwefomu elihlobene nokusebenzisa aria-describedby
. Okunye, qinisekisa ukuthi incazelo (isibonelo, iqiniso lokuthi kunesexwayiso senkambu ethile yokufaka umbhalo) idluliswa ngenye indlela, njengokushintsha umbhalo wangempela <label>
ohlotshaniswa nokulawulwa kwefomu.
Nakuba izibonelo ezilandelayo sezivele zisisho isimo sokuqinisekisa sokulawulwa kwazo kwefomu ngokulandelana kwazo <label>
embhalweni ngokwawo, le nqubo engenhla (ukusebenzisa .sr-only
umbhalo kanye aria-describedby
) ifakiwe ngokwezinjongo zemifanekiso.
.sr-only
Izithonjana ozikhethela zona ezinamalebula afihliweUma usebenzisa .sr-only
ikilasi ukufihla isilawuli sefomu <label>
(kunokusebenzisa ezinye izinketho zokulebula, njengesibaluli aria-label
), i-Bootstrap izolungisa ngokuzenzakalelayo indawo yesithonjana uma seyengeziwe.
Setha ubude usebenzisa amakilasi afana nokuthi .input-lg
, futhi usethe ububanzi usebenzisa amakilasi ekholomu yegridi .col-lg-*
.
Dala izilawuli zefomu ezinde noma ezifushane ezifana nosayizi bezinkinobho.
Ngokushesha usayizi wamalebula kanye nezilawuli zefomu ngaphakathi .form-horizontal
ngokungeza .form-group-lg
noma .form-group-sm
.
Goqa okokufaka kumakholomu egridi, nanoma iyiphi ingxenye yangokwezifiso yomzali, ukuze usebenzise kalula ububanzi obufunekayo.
Sebenzisa amakilasi enkinobho kokuthi <a>
, <button>
, noma <input>
isici.
Nakuba amakilasi ezinkinobho angasetshenziswa kuwo <a>
kanye nama - <button>
elementi, ama- <button>
elementi kuphela asekelwayo ngaphakathi kwezingxenye zethu ze-nav ne-navbar.
Uma <a>
izakhi zisetshenziselwa ukusebenza njengezinkinobho - ukuqala ukusebenza kwekhasi, kunokuzulazula uye kwenye idokhumenti noma isigaba esingaphakathi kwekhasi lamanje - kufanele futhi zinikezwe ezifanele role="button"
.
Njengomkhuba ongcono kakhulu, sincoma kakhulu ukusebenzisa i- <button>
elementi noma nini lapho kunokwenzeka ukuze uqinisekise ukunikezwa okufanayo kwesiphequluli.
Phakathi kwezinye izinto, kunesiphazamisi kuFirefox <30 esivimbela ekusetheni izinkinobho line-height
ze-- <input>
based, okubangela ukuthi zingafani ncamashi nobude bezinye izinkinobho kuFirefox.
Sebenzisa noma yimaphi amakilasi enkinobho atholakalayo ukuze udale ngokushesha inkinobho enesitayela.
Ukusebenzisa umbala ukwengeza incazelo enkinobho kunikeza kuphela inkomba ebonakalayo, engeke idluliselwe kubasebenzisi bobuchwepheshe obusizayo - njengezifundi zesikrini. Qinisekisa ukuthi ulwazi olushiwo umbala lusobala kokuqukethwe ngokwako (umbhalo obonakalayo wenkinobho), noma ufakiwe ngezinye izindlela, njengombhalo owengeziwe ofihliwe .sr-only
nekilasi.
Uyathanda izinkinobho ezinkulu noma ezincane? Engeza .btn-lg
, .btn-sm
, noma .btn-xs
osayizi abengeziwe.
Dala izinkinobho zeleveli yebhulokhi—lezo ezinobubanzi obugcwele bomzali— ngokungeza .btn-block
.
Izinkinobho zizovela zicindezelwe (ezinengemuva elimnyama, umngcele omnyama, nesithunzi esifakiwe) uma isebenza. Ngezakhi <button>
, lokhu kwenziwa nge- :active
. Okwezakhi <a>
, kwenziwa nge- .active
. Nokho, ungasebenzisa .active
kokuthi <button>
s (futhi ufake aria-pressed="true"
isibaluli) uma udinga ukuphindaphinda isimo esisebenzayo ngokohlelo.
Asikho isidingo sokwengeza :active
njengoba kuyisigaba-mbumbulu, kodwa uma udinga ukuphoqa ukubukeka okufanayo, qhubeka futhi wengeze .active
.
Engeza .active
ikilasi <a>
ezinkinobho.
Isixhumanisi esiyinhloko Isixhumanisi
Yenza izinkinobho zibukeke zingachofozeki ngokuzifiphala ngokuthi opacity
.
Engeza disabled
isibaluli <button>
ezinkinobho.
Uma ungeza disabled
isibaluli ku- <button>
, Internet Explorer 9 nangezansi kuzonikeza umbhalo ompunga ngesithunzi sombhalo esibi esingeke sikwazi ukusilungisa.
Engeza .disabled
ikilasi <a>
ezinkinobho.
Isixhumanisi esiyinhloko Isixhumanisi
Sisebenzisa .disabled
njengesigaba sokusetshenziswa lapha, esifana nesigaba esivamile .active
, ngakho-ke asikho isiqalo esidingekayo.
Leli klasi lisebenzisa pointer-events: none
ukuzama ukukhubaza ukusebenza kwesixhumanisi kwe- <a>
s, kodwa leso sakhiwo se-CSS asikakamiswa futhi asisekelwa ngokugcwele ku-Opera 18 nangaphansi, noma ku-Internet Explorer 11. Ngaphezu kwalokho, ngisho nasezipheqululini ezisekela pointer-events: none
, ikhibhodi ukuzulazula kuhlala kungathinteki, okusho ukuthi abasebenzisi bekhibhodi ababonayo nabasebenzisi bobuchwepheshe obusizayo basazokwazi ukwenza lezi zixhumanisi zisebenze. Ngakho ukuze uphephe, sebenzisa i-JavaScript yangokwezifiso ukuze ukhubaze izixhumanisi ezinjalo.
Izithombe eziku-Bootstrap 3 zingenziwa ziphenduleke kalula ngokungezwa .img-responsive
kwekilasi. Lokhu kuyasebenza max-width: 100%;
, height: auto;
nasesithombeni display: block;
ukuze sikhule kahle kusici esingumzali.
Ukuze ubeke phakathi izithombe ezisebenzisa .img-responsive
ikilasi, sebenzisa .center-block
esikhundleni se- .text-center
. Bona isigaba samakilasi omsizi ukuze uthole imininingwane eyengeziwe mayelana .center-block
nokusetshenziswa.
Ku-Internet Explorer 8-10, izithombe ze-SVG ezinamasayizi .img-responsive
alinganisiwe. Ukuze ulungise lokhu, engeza width: 100% \9;
lapho kudingeka khona. I-Bootstrap ayikusebenzisi lokhu ngokuzenzakalelayo njengoba idala izinkinga kwamanye amafomethi wesithombe.
Engeza amakilasi <img>
entweni ukuze wenze isitayela kalula izithombe kunoma iyiphi iphrojekthi.
Khumbula ukuthi i-Internet Explorer 8 ayinalo usekelo lwamakhona ayindilinga.
Dlulisa incazelo ngombala ngedlanzana lezinsiza zokugcizelela. Lezi zingaphinda zisetshenziswe kuzixhumanisi futhi zizoba mnyama ngokuhambisa phezulu njengezitayela zethu zokuxhuma ezizenzakalelayo.
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.
I-Etiam porta sem malesuada magna mollis euismod.
I-Donec ullamcorper nulla non metus auctor fringilla.
Kwesinye isikhathi amakilasi okugcizelela awakwazi ukusetshenziswa ngenxa yokucaciswa kwesinye isikhethi. Ezimweni eziningi, i-workaround eyanele ukusonga umbhalo wakho <span>
ngeklasi.
Ukusebenzisa umbala ukwengeza incazelo kunikeza kuphela inkomba ebonakalayo, engeke idluliselwe kubasebenzisi bobuchwepheshe obusizayo - njengezifundi zesikrini. Qinisekisa ukuthi ulwazi olushiwo umbala lusobala kokuqukethwe ngokwako (imibala yomongo isetshenziselwa kuphela ukuqinisa incazelo esivele ikhona embhalweni/emakhakheni), noma ifakiwe ngezinye izindlela, njengombhalo owengeziwe ofihliwe .sr-only
neklasi. .
Ngokufana nezigaba zombala wombhalo womongo, setha kalula ingemuva lesici kunoma yisiphi isigaba somongo. Izingxenye zehange zizoba mnyama ngokuhambisa phezulu, njengamakilasi ombhalo.
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.
I-Etiam porta sem malesuada magna mollis euismod.
I-Donec ullamcorper nulla non metus auctor fringilla.
Kwesinye isikhathi amakilasi angemuva komongo awakwazi ukusetshenziswa ngenxa yokucaciswa kwesinye isikhethi. Kwezinye izimo, i-workaround eyanele ukusonga okuqukethwe kwe-elementi yakho <div>
ngeklasi.
Njengemibala yomongo , qiniseka ukuthi noma iyiphi incazelo edluliswa ngombala iphinde idluliselwe ngefomethi engeyona eyethulo kuphela.
Sebenzisa isithonjana sokuvala esijwayelekile ukuze uchithe okuqukethwe okufana namamodeli nezixwayiso.
Sebenzisa ama-carets ukukhombisa ukusebenza kokwehla kanye nesiqondiso. Qaphela ukuthi i-caret ezenzakalelayo izohlehla ngokuzenzakalelayo kumamenyu okwehlayo .
Nntanta i-elementi kwesokunxele noma kwesokudla ngeklasi. !important
ifakiwe ukugwema izinkinga ezithile. Amakilasi angasetshenziswa futhi njengama-mixins.
Misa i-elementi ukuze uyibeke display: block
phakathi margin
. Itholakala njenge-mixin neklasi.
Sula kalula float
s ngokungeza .clearfix
isici esingumzali . Isebenzisa i-micro clearfix njengoba idume nguNicolas Gallagher. Ingasetshenziswa futhi njenge-mixin.
Phoqa into ukuthi iboniswe noma ifihlwe ( okuhlanganisa nezifundi zesikrini ) ngokusetshenziswa .show
kanye .hidden
namakilasi. Lezi zigaba zisebenzisa !important
ukugwema ukungqubuzana okuthile, njengokuntanta okusheshayo . Atholakala kuphela ekuguquleni izinga lebhulokhi. Zingasetshenziswa futhi njengama-mixins.
.hide
iyatholakala, kodwa ayizithinti njalo izifundi zesikrini futhi iyahoxiswa kusukela ku-v3.0.1. Sebenzisa .hidden
noma .sr-only
esikhundleni salokho.
Ngaphezu kwalokho, .invisible
ingasetshenziswa ukuguqula ukubonakala kwe-elementi kuphela, okusho ukuthi display
ayilungiswanga futhi isici sisengaphazamisa ukuhamba kwedokhumenti.
Fihla i-elementi kuwo wonke amadivayisi ngaphandle kwezifundi zesikrini ezine- .sr-only
. Hlanganisa nokukhombisa isici .sr-only
futhi .sr-only-focusable
uma sigxilile (isb ngumsebenzisi wekhibhodi kuphela). Kuyadingeka ukuze ulandele izinqubo ezingcono kakhulu zokufinyelela . Ingasetshenziswa futhi njengama-mixins.
Sebenzisa .text-hide
ikilasi noma i-mixin ukuze usize esikhundleni sokuqukethwe kombhalo we-elementi ngesithombe sangemuva.
Ukuze uthole intuthuko esheshayo yeselula, sebenzisa lezi zigaba zensiza ukuze ubonise futhi ufihle okuqukethwe ngedivayisi ngombuzo wemidiya. Kufakwe futhi amakilasi okusebenza okuguqula okuqukethwe uma kuphrintiwe.
Zama ukusebenzisa lezi ngesisekelo esilinganiselwe futhi ugweme ukudala izinguqulo ezihluke ngokuphelele zesayithi elifanayo. Kunalokho, zisebenzise ukuze zigcwalise isethulo sedivayisi ngayinye.
Sebenzisa eyodwa noma inhlanganisela yamakilasi atholakalayo ukuze uguqule okuqukethwe kuzo zonke izinqamuleli zembobo yokubuka.
Imishini emincane eyengeziweAmafoni (<768px) | Amadivayisi amancaneAmathebulethi (≥768px) | Amadivayisi aphakathiAmadeskithophu (≥992px) | Amadivayisi amakhuluAmadeskithophu (≥1200px) | |
---|---|---|---|---|
.visible-xs-* |
Kubonakala | Kufihliwe | Kufihliwe | Kufihliwe |
.visible-sm-* |
Kufihliwe | Kubonakala | Kufihliwe | Kufihliwe |
.visible-md-* |
Kufihliwe | Kufihliwe | Kubonakala | Kufihliwe |
.visible-lg-* |
Kufihliwe | Kufihliwe | Kufihliwe | Kubonakala |
.hidden-xs |
Kufihliwe | Kubonakala | Kubonakala | Kubonakala |
.hidden-sm |
Kubonakala | Kufihliwe | Kubonakala | Kubonakala |
.hidden-md |
Kubonakala | Kubonakala | Kufihliwe | Kubonakala |
.hidden-lg |
Kubonakala | Kubonakala | Kubonakala | Kufihliwe |
Kusukela ku-v3.2.0, .visible-*-*
amakilasi ephoyinti ngalinye lokuhlukana afika ngezinhlobonhlobo ezintathu, okukodwa display
kwenani lesakhiwo ngasinye se-CSS esohlwini olungezansi.
Iqembu lamakilasi | CSSdisplay |
---|---|
.visible-*-block |
display: block; |
.visible-*-inline |
display: inline; |
.visible-*-inline-block |
display: inline-block; |
Ngakho, ngezikrini ( ) ezincane ezengeziwe xs
ngokwesibonelo, .visible-*-*
amakilasi atholakalayo yilawa: .visible-xs-block
, .visible-xs-inline
, kanye .visible-xs-inline-block
.
Amakilasi .visible-xs
, .visible-sm
, .visible-md
, .visible-lg
futhi akhona, kodwa ahoxisiwe kusukela ku-v3.2.0 . Cishe zilingana no- .visible-*-block
, ngaphandle kwezimo ezikhethekile ezengeziwe <table>
zokuguqula izici ezihlobene.
Ngokufanayo namakilasi avamile aphendulayo, sebenzisa lokhu ukuze uguqule okuqukethwe ukuze uphrinte.
Amakilasi | Isiphequluli | Phrinta |
---|---|---|
.visible-print-block .visible-print-inline .visible-print-inline-block |
Kufihliwe | Kubonakala |
.hidden-print |
Kubonakala | Kufihliwe |
Ikilasi .visible-print
nalo likhona kodwa liyehliswa kusukela ku- v3.2.0 . Cishe ilingana no- .visible-print-block
, ngaphandle kwamacala akhethekile angeziwe <table>
wezinto ezihlobene.
Shintsha usayizi wesiphequluli sakho noma ulayishe kumadivayisi ahlukene ukuze uhlole amakilasi ensiza esabelayo.
Omaka abaluhlaza bakhombisa ukuthi i-elementi iyabonakala endaweni yakho yokubuka yamanje.
Lapha, omaka abaluhlaza baphinde babonise ukuthi isici sifihliwe endaweni yakho yokubuka yamanje.
I-CSS ye-Bootstrap yakhelwe kokuthi Okuncane, i-preprocessor enokusebenza okwengeziwe okufana nokuguquguqukayo, imiksi, nemisebenzi yokuhlanganisa i-CSS. Labo abafuna ukusebenzisa umthombo Amafayela Ancane esikhundleni samafayela ethu e-CSS ahlanganisiwe bangasebenzisa okuguquguqukayo okuningi namamiksi esiwasebenzisa kulo lonke uhlaka.
Okuguquguqukayo kwegridi nezixube kufakwe ngaphakathi kwesigaba sesistimu yeGridi .
I-Bootstrap ingasetshenziswa okungenani ngezindlela ezimbili: nge-CSS ehlanganisiwe noma ngomthombo Amafayela amancane. Ukuze uhlanganise Amafayela Amancane, bheka ingxenye ethi Ukuqalisa ukuze uthole ukuthi ungasetha kanjani indawo yakho yokuthuthukisa ukuze usebenzise imiyalo edingekayo.
Amathuluzi okuhlanganiswa ezinkampani zangaphandle angase asebenze ne-Bootstrap, kodwa awasekelwe ithimba lethu eliyinhloko.
Okuguquguqukayo kusetshenziswa kuyo yonke iphrojekthi njengendlela yokuhlanganisa nokwabelana ngamavelu asetshenziswa kakhulu njengemibala, isikhala, noma izitaki zefonti. Ukuze uthole ukwaziswa okwengeziwe, sicela ubone i-Customizer .
Sebenzisa kalula izikimu zemibala ezimbili: i-grayscale ne-semantic. Imibala engwevu inikeza ukufinyelela okusheshayo kumathunzi avamile amnyama kuyilapho i-semantiki ihlanganisa imibala ehlukahlukene eyabelwe amanani onomongo anenjongo.
Sebenzisa noma yikuphi kwalokhu okuguquguqukayo kwemibala njengoba kunjalo noma ukwabele kabusha kokuguquguqukayo okunengqondo kwephrojekthi yakho.
Idlanzana lezinto eziguquguqukayo zokwenza ngokwezifiso izici ezibalulekile zohlaka lwamathambo esayithi lakho.
Yenza isitayela kalula izixhumanisi zakho ngombala olungile onevelu eyodwa kuphela.
Qaphela ukuthi @link-hover-color
isebenzisa umsebenzi, elinye ithuluzi elimangalisayo elivela kokuncane, ukuze lidale ngokuzenzakalelayo umbala olungile ohambisa phezulu. Ungasebenzisa darken
, lighten
, saturate
, futhi desaturate
.
Setha kalula uhlobo lwakho lokubhala, usayizi wombhalo, okuholayo, nokuningi ngeziguquko ezimbalwa ezisheshayo. I-Bootstrap isebenzisa lezi futhi ukuze inikeze imiksi ye-typographic elula.
Izinguquko ezimbili ezisheshayo zokwenza ngokwezifiso indawo negama lefayela lezithonjana zakho.
Izingxenye kuyo yonke i-Bootstrap zisebenzisa okuguquguqukayo okuzenzakalelayo ukusetha amanani avamile. Nazi ezisetshenziswa kakhulu.
Izingxube zabathengisi ziyimiksi ukusiza ukusekela iziphequluli eziningi ngokufaka zonke iziqalo zomthengisi ezifanele ku-CSS yakho ehlanganisiwe.
Setha kabusha imodeli yebhokisi lezingxenye zakho nge-mixin eyodwa. Ukuze uthole umongo, bona lesi sihloko esiwusizo esivela ku-Mozilla .
I-mixin yehlisiwe kusukela ku-v3.2.0, ngokwethulwa kwe-Autoprefixer. Ukuze ulondoloze ukuhambisana nokubuyela emuva, i-Bootstrap izoqhubeka nokusebenzisa i-mixin ngaphakathi kuze kube i-Bootstrap v4.
Namuhla zonke iziphequluli zesimanje zisekela isici esingenasiqalo border-radius
. Kanjalo, ayikho i- .border-radius()
mixin, kodwa i-Bootstrap ihlanganisa izinqamuleli zokuzungeza ngokushesha amakhona amabili ohlangothini oluthile lwento.
Uma izethameli zakho eziqondisiwe zisebenzisa iziphequluli zakamuva nezinkulu kakhulu namadivayisi, qiniseka ukuthi usebenzisa box-shadow
isakhiwo sodwa. Uma udinga ukusekelwa kwamadivayisi amadala e-Android (pre-v4) kanye ne-iOS (pre-iOS 5), sebenzisa imiksi ehoxisiwe ukuze uthathe -webkit
isiqalo esidingekayo.
I-mixin ihoxisiwe kusukela ku-v3.1.0, njengoba i-Bootstrap ingasekeli ngokusemthethweni izinkundla eziphelelwe yisikhathi ezingasisekeli isakhiwo esijwayelekile. Ukuze ulondoloze ukuhambisana nokubuyela emuva, i-Bootstrap izoqhubeka nokusebenzisa i-mixin ngaphakathi kuze kube i-Bootstrap v4.
Qiniseka ukuthi usebenzisa rgba()
imibala emabhokisini akho ezithunzi ukuze ahlangane ngokuphumelelayo nezingemuva.
Izingxube eziningi zokuguquguquka. Setha lonke ulwazi loshintsho ngalolodwa, noma ucacise ukubambezeleka okuhlukile nobude besikhathi njengoba kudingeka.
Amamiksi ahoxisiwe kusukela ku-v3.2.0, ngokwethulwa kwe-Autoprefixer. Ukuze ulondoloze ukuhambisana nokubuyela emuva, i-Bootstrap izoqhubeka nokusebenzisa imiksi ngaphakathi kuze kube i-Bootstrap v4.
Zungezisa, sikala, humusha (susa), noma tshekisa noma iyiphi into.
Amamiksi ahoxisiwe kusukela ku-v3.2.0, ngokwethulwa kwe-Autoprefixer. Ukuze ulondoloze ukuhambisana nokubuyela emuva, i-Bootstrap izoqhubeka nokusebenzisa imiksi ngaphakathi kuze kube i-Bootstrap v4.
I-mixin eyodwa yokusebenzisa zonke izici zokugqwayiza ze-CSS3 kusimemezelo esisodwa kanye nezinye izingxube zezakhiwo ezingazodwana.
Amamiksi ahoxisiwe kusukela ku-v3.2.0, ngokwethulwa kwe-Autoprefixer. Ukuze ulondoloze ukuhambisana nokubuyela emuva, i-Bootstrap izoqhubeka nokusebenzisa imiksi ngaphakathi kuze kube i-Bootstrap v4.
Setha ukufiphala kwazo zonke iziphequluli futhi unikeze isiphetho filter
se-IE8.
Nikeza umongo wezilawuli zefomu ngaphakathi kwenkambu ngayinye.
Khiqiza amakholomu nge-CSS ngaphakathi kwento eyodwa.
Shintsha kalula noma yimiphi imibala emibili wenze igradient yangemuva. Thuthukela kakhulu futhi usethe isiqondiso, sebenzisa imibala emithathu, noma sebenzisa i-radial gradient. Nge-mixin eyodwa uthola wonke ama-syntaxes anesiqalo ozowadinga.
Ungaphinda ucacise i-engeli yemibala emibili ejwayelekile, i-gradient yomugqa:
Uma udinga i-gradient yesitayela se-barber-stripe, kulula lokho, futhi. Vele ucacise umbala owodwa futhi sizomboza umugqa omhlophe ocwebezelayo.
Phakamisa i-ante futhi usebenzise imibala emithathu esikhundleni salokho. Setha umbala wokuqala, umbala wesibili, ukuma kombala wombala wesibili (inani eliyiphesenti elifana no-25%), nombala wesithathu ngale miksi:
Amakhanda phezulu! Uma kwenzeka udinga ukususa i-gradient, qiniseka ukuthi ususa noma iyiphi i-IE-specific filter
okungenzeka ukuthi uyingezile. Ungakwenza lokho ngokusebenzisa i- .reset-filter()
mixin eceleni background-image: none;
.
Izingxube zezinsiza ziyingxube ehlanganisa izakhiwo ze-CSS ezingahlobene ukuze kuzuzwe umgomo othile noma umsebenzi.
Khohlwa ukwengeza class="clearfix"
kunoma iyiphi into futhi esikhundleni salokho wengeze .clearfix()
imiksi lapho kufanele khona. Isebenzisa i- micro clearfix evela ku- Nicolas Gallagher .
Ngokushesha beka phakathi noma iyiphi into ngaphakathi komzali wayo. Idinga width
noma max-width
ukusethwa.
Cacisa ubukhulu bento kalula.
Lungiselela kalula izinketho zokushintsha usayizi wanoma iyiphi indawo yombhalo, nanoma iyiphi enye into. Okuzenzakalelayo ekuziphatheni kwesiphequluli okujwayelekile ( both
).
Nciphisa kalula umbhalo nge-ellipsis nge-mixin eyodwa. Idinga into ukuthi ibe block
noma inline-block
ileveli.
Cacisa izindlela ezimbili zesithombe kanye nobukhulu besithombe esingu-@1x, futhi i-Bootstrap izohlinzeka ngombuzo we-@2x wemidiya. Uma unezithombe eziningi ongazisebenzisa, cabanga ukubhala isithombe sakho se-retina i-CSS mathupha embuzweni owodwa wemidiya.
Ngenkathi i-Bootstrap yakhelwe kokuthi Okuncane, futhi inechweba elisemthethweni le-Sass . Siyigcina endaweni ehlukile ye-GitHub futhi siphatha izibuyekezo ngombhalo wokuguqula.
Njengoba ichweba le-Sass linerepo ehlukile futhi lisebenzela izethameli ezihluke kancane, okuqukethwe kwephrojekthi kuhluke kakhulu kuphrojekthi enkulu ye-Bootstrap. Lokhu kuqinisekisa ukuthi ichweba lakwa-Sass lihambisana nezinhlelo eziningi ezisekelwe kwa-Sass ngangokunokwenzeka.
Indlela | Incazelo |
---|---|
lib/ |
Ikhodi ye-Ruby gem (ukulungiswa kwe-Sass, ukuhlanganiswa kwe-Rails ne-Compass) |
tasks/ |
Imibhalo yokuguqula (ukuguqula umfula ukhuphuke Kancane kuye ku-Sass) |
test/ |
Ukuhlolwa kokuhlanganiswa |
templates/ |
I-manifest yephakheji yekhampasi |
vendor/assets/ |
I-Sass, i-JavaScript, namafayela efonti |
Rakefile |
Imisebenzi yangaphakathi, efana ne-rake nokuguqula |
Vakashela inqolobane ye-GitHub yembobo ye-Sass ukuze ubone lawa mafayela esebenza.
Ukuze uthole ulwazi mayelana nendlela yokufaka nokusebenzisa i-Bootstrap ye-Sass, thintana ne- GitHub repository readme . Iwumthombo osesikhathini samanje futhi ihlanganisa ulwazi oluzosetshenziswa ne-Rails, Compass, namaphrojekthi ajwayelekile akwa-Sass.