SourceIifom
Imizekelo kunye nezikhokelo zokusetyenziswa kweendlela zokulawula iifom, iinketho zokubeka, kunye namacandelo angokwezifiso ekudaleni iintlobo ezininzi zeefom.
Isishwankathelo
Ulawulo lwefom ye-Bootstrap yandisa kwizimbo zethu zefom eQaliswe ngokutsha ngeeklasi. Sebenzisa ezi klasi ukungena kwiziboniso zazo ezilungiselelwe unikezelo olungaguquguqukiyo kuzo zonke iibhrawuza kunye nezixhobo.
Qinisekisa ukusebenzisa uphawu olufanelekileyo type
kuwo onke amagalelo (umzekelo, email
idilesi ye-imeyile okanye number
ngolwazi lwamanani) ukuthatha ithuba lolawulo lwamagalelo amatsha njengesiqinisekiso se-imeyile, ukukhetha amanani, nokunye.
Nanku umzekelo okhawulezayo ukubonisa izimbo zeBootstrap. Gcina ufundela amaxwebhu kwiiklasi ezifunekayo, uyilo lwefom, kunye nokunye.
Ulawulo lweefom zombhalo-njengo- <input>
s, <select>
s, kunye no <textarea>
-s-zibhalwa kunye .form-control
neklasi. Okubandakanyiweyo zizitayile zenkangeleko jikelele, imeko ekugxilwe kuyo, ubungakanani, kunye nokunye.
Qiniseka ukuba uphonononga iifom zethu zesiko ukuqhubela phambili isimbo <select>
s.
Kumagalelo efayile, tshintshela .form-control
kwi .form-control-file
.
Ubungakanani
Seta ubude usebenzisa iiklasi ezifana .form-control-lg
kunye .form-control-sm
.
Funda uqhubeleke
Yongeza readonly
uphawu lwe boolean kwigalelo ukunqanda ukulungiswa kwexabiso legalelo. Amagalelo okufunda kuphela abonakala ekhaphukhaphu (njengamagalelo avaliweyo), kodwa gcina ikhesa esemgangathweni.
Funda kuphela isicatshulwa esicacileyo
Ukuba ufuna ukuba <input readonly>
nezinto kwimo yakho ezibhalwe njengombhalo ongenanto, sebenzisa .form-control-plaintext
iklasi ukususa isimbo sommandla wefomu engagqibekanga kwaye ugcine umda ochanekileyo kunye nokhupho.
Cwangcisa amagalelo oluhlu olusongelo oluthe tye usebenzisa .form-control-range
.
Iibhokisi zokutshekisha kunye noonomathotholo
Iibhokisi zokukhangela ezihlala zikhona kunye nonomathotholo ziphuculwe ngoncedo lwe .form-check
, iklasi enye yazo zombini iindidi zegalelo eziphucula ubeko nokuziphatha kwezinto zabo ze HTML . Iibhokisi zokukhangela zezokukhetha enye okanye iinketho ezininzi kuluhlu, ngelixa oonomathotholo bezokukhetha ukhetho olunye kwabaninzi.
Iibhokisi zokukhangela ezikhubazekileyo kunye nerediyo ziyaxhaswa. Uphawu disabled
loyelelwano luya kusebenzisa umbala olula ukunceda ukubonisa ubume begalelo.
Iibhokisi zokutshekisha kunye namaqhosha erediyo axhasa ukuqinisekiswa kwefomu esekwe kwi-HTML kunye nokubonelela ngeelebhile ezimfutshane, ezifikelelekayo. Ngaloo ndlela, <input>
imiz kunye nemizalwane yethu <label>
zizinto zokuzalana ngokuchaseneyo <input>
nengaphakathi <label>
. Oku kukwi-verbose kancinane njengoko kufuneka ukhankanye id
kunye for
neempawu zokunxulumana <input>
ne <label>
.
Okuhlala kukho (kupakishwe)
Ngokungagqibekanga, naliphi na inani leebhokisi zokukhangela kunye nonomathotholo abazalanayo baya kugcinwa ngokuthe nkqo kwaye zibekwe ngokufanelekileyo nge .form-check
.
Nomgca
Qela iibhokisi zokukhangela okanye iirediyo kumqolo othe tye ngokudibanisa .form-check-inline
nakweyiphi .form-check
.
Ngaphandle kweelebhile
Yongeza .position-static
kumagalelo aphakathi .form-check
koko akunambhalo weleyibhile. Khumbula ukuba usenokubonelela ngolunye uhlobo lweleyibhile yeetekhnoloji ezincedisayo (umzekelo, ukusebenzisa aria-label
).
Uyilo
Kuba iBootstrap isebenza display: block
kwaye width: 100%
phantse kulo lonke uhlobo lwethu lolawulo, iifom ziya kuthi ngokungagqibekanga zipakishwe ngokuthe nkqo. Iiklasi ezongezelelweyo zingasetyenziselwa ukuhluka kolu yilo ngokwefom.
Iklasi .form-group
yeyona ndlela ilula yokongeza isakhiwo kwiifom. Ibonelela ngodidi oluguquguqukayo olukhuthaza ukuhlelwa ngokufanelekileyo kweelebhile, ulawulo, isicatshulwa soncedo esikhethwayo, kunye nefomu yokuqinisekisa imiyalezo. Ngokungagqibekanga iyasebenza kuphela margin-bottom
, kodwa ithatha izitayile ezongezelelweyo .form-inline
njengoko kufuneka. Yisebenzise kunye no- <fieldset>
s, <div>
s, okanye phantse nayiphi na enye into.
Iifom ezinzima ngakumbi zinokukhiwa kusetyenziswa iiklasi zethu zegridi. Sebenzisa ezi kuyilo lweefom ezifuna iikholamu ezininzi, ububanzi obahlukeneyo, kunye nokhetho olongezelelweyo lolungelelwaniso.
Ungatshintshiselana kwakhona .row
, .form-row
umahluko womqolo wethu wegridi osemgangathweni ogqithisela ngaphezulu kwimijelo yoluhlu olumiselweyo loyilo oluqina kunye noluxineneyo ngakumbi.
Uyilo oluntsonkothileyo lunokwenziwa kunye nenkqubo yegridi.
Yenza iifom ezithe tyaba ngegridi ngokudibanisa .row
iklasi ukwenza amaqela kunye nokusebenzisa .col-*-*
iiklasi ukucacisa ububanzi beelebhile zakho kunye nolawulo. Qinisekisa ukuba ukongeza .col-form-label
kwi- <label>
s yakho ngokunjalo ukuze babekwe ngokuthe nkqo embindini nolawulo lwefom enxulumeneyo.
Ngamanye amaxesha, kuya kufuneka usebenzise i-margin okanye i-padding eziluncedo ukwenza ulungelelwaniso olugqibeleleyo oludingayo. Umzekelo, siyisusile padding-top
ileyibhile kwirediyo yethu epakishweyo ukuze silungelelanise ngcono isiseko sombhalo.
Qinisekisa ukusebenzisa .col-form-label-sm
okanye .col-form-label-lg
kwi- <label>
s okanye <legend>
kwi-s yakho ukulandela ngokuchanekileyo ubungakanani .form-control-lg
kunye ne .form-control-sm
.
Ubungakanani bekholamu
Njengoko kubonisiwe kwimizekelo yangaphambili, inkqubo yethu yegridi ikuvumela ukuba ubeke naliphi na inani lika .col
s ngaphakathi .row
okanye .form-row
. Baza kwahlula ububanzi obukhoyo ngokulinganayo phakathi kwabo. Ungaphinda ukhethe iseti esezantsi yeentsika zakho ukuthatha indawo eninzi okanye encinci, ngelixa u- .col
s oseleyo wahlulahlula ngokulinganayo okunye, ngeeklasi ezithile zekholamu njenge .col-7
.
Ukulinganisa okuzenzekelayo
Umzekelo ongezantsi usebenzisa into eluncedo ye-flexbox ukubeka embindini ngokuthe nkqo imixholo kunye notshintsho .col
ukuze .col-auto
iikholomu zakho zithathe kuphela indawo eninzi njengoko kufuneka. Beka enye indlela, ubukhulu bekholamu ngokwayo ngokusekelwe kwimixholo.
Ungayixuba kwakhona loo nto kwakhona ngeeklasi zekholamu zobungakanani obuthile.
Kwaye ngokuqinisekileyo ulawulo lwefom yesiko luyaxhaswa.
Sebenzisa .form-inline
iklasi ukubonisa uluhlu lweelebhile, ulawulo lwefom, kunye namaqhosha kumqolo omnye othe tye. Ulawulo lweefomu ngaphakathi kweefom ezingaphakathi komgca ziyohluka kancinci kwiimeko zazo ezisilelayo.
- Izilawuli zi
display: flex
, ziwisa nasiphi na isithuba esimhlophe seHTML kwaye ikuvumela ukuba unikeze ngolawulo lolungelelwaniso ngezithuba kunye nezinto eziluncedo ze - flexbox .
- Amaqela olawulo kunye namagalelo afumana
width: auto
ukukhuphela ngaphezulu i-Bootstrap engagqibekanga width: 100%
.
- Izilawuli zivela kuphela emgceni kwiizibuko zokujonga ubuncinane eziyi-576px ububanzi ukuze kunikwe ingxelo ngeendawo zokujonga ezimxinwa kwizixhobo eziphathwayo.
Kusenokufuneka ukuba ulungise ngesandla ububanzi kunye nolungelelwaniso lolawulo lwefomu nganye kunye nezixhobo zokubeka izithuba (njengoko kubonisiwe ngezantsi). Okokugqibela, qiniseka ukuba uhlala ubandakanya <label>
ulawulo lwefom nganye, nokuba ufuna ukuyifihla kwiindwendwe ezingafundi isikrini nge .sr-only
.
Ulawulo lwefomu yesiko kunye nokukhetha kuyaxhaswa.
Iindlela ezizezinye kwiilebhile ezifihliweyo
Itekhnoloji ezincedisayo ezifana nezifundi zesikrini ziya kuba nengxaki kwiifomu 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, ubuchwephesha obuncedisayo busenokubhenela ekusebenziseni placeholder
uphawu, ukuba lukhona, kodwa qaphela ukuba ukusetyenziswa placeholder
kwendawo yezinye iindlela zokuleyibheli akucetyiswa.
Umbhalo woncedo
Isicatshulwa soncedo lwenqanaba lebhlokhi kwiifom zinokudalwa kusetyenziswa .form-text
(eyaziwa ngaphambili njenge .help-block
-v3). Okubhaliweyo koncedo lwangaphakathi kunokuphunyezwa ngokuguquguqukayo kusetyenziswa nasiphi na isiqalelo se-HTML esingaphakathi kunye neeklasi eziluncedo ezifana .text-muted
.
Ukunxulumanisa isicatshulwa soncedo kunye nolawulo 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.
Umbhalo woncedo ongezantsi kongeniso ungalungiswa nge .form-text
. Le klasi ibandakanya display: block
kwaye yongeza umda ophezulu wezithuba ezilula ukusuka kumagalelo angentla.
Iphasiwedi yakho mayibe nobude obuyi-8-20 oonobumba ubude, iqulathe oonobumba kunye namanani, kwaye mayingaqulathi izithuba, amagama akhethekileyo, okanye i-emoji.
Okubhaliweyo okungaphakathi kunokusebenzisa nayiphi na into eqhelekileyo engaphakathi kwe HTML isiqalelo (inokuba yi <small>
, <span>
, okanye enye into) kungekho nto ingaphaya kodidi oluluncedo.
Yongeza disabled
uphawu lwe-boolean kwigalelo ukuthintela ukusebenzisana komsebenzisi kwaye ulwenze lubonakale lula.
Yongeza disabled
uphawu ku a <fieldset>
ukuvala zonke izilawuli ngaphakathi.
Caveat ngeeankile
Ngokungagqibekanga, abakhangeli bazakuthatha lonke ulawulo lwefomu yemveli ( <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 ekhubazekileyo yamaqhosha (kwaye ngokukodwa kwicandelo elingaphantsi lezinto ze-ankile), le propati ye-CSS ayikamiselwa mgangathweni kwaye ayixhaswanga ngokupheleleyo kwi-Internet Explorer 10, kwaye ayizukuthintela abasebenzisi bebhodi yezitshixo ukuba ekwaziyo ukugxila okanye ukuvula la makhonkco. Ke ukuze ukhuseleke, sebenzisa iJavaScript yesiko ukuvala amakhonkco anjalo.
Ukuhambelana kwebrowser
Ngelixa i-Bootstrap izakusebenzisa ezi zimbo kuzo zonke iibhrawuza, i-Internet Explorer 11 nangaphantsi ayiluxhasi ngokupheleleyo disabled
uphawu lwe- <fieldset>
. Sebenzisa iJavaScript yesiko ukuvala iseti yangaphandle kwezi bhrawuza.
Ukuqinisekiswa
Nikeza ngengxelo ebalulekileyo, esebenzayo kubasebenzisi bakho ngokuqinisekiswa kwefomu yeHTML5- ifumaneka kuzo zonke iibhrawuza zethu ezixhaswayo . Khetha kwingxelo yokuqinisekisa engagqibekanga yesikhangeli, okanye sebenzisa imiyalezo yesiko ngeeklasi ezakhelwe ngaphakathi kunye neJavaScript yokuqalisa.
Ngoku sicebisa ukuba kusetyenziswe izitayile zokuqinisekisa ngokwesiko, njengoko imiyalezo yokuqinisekisa isikhangeli semveli ayisoloko iboniswa kwiitekhnoloji ezincedisayo kuzo zonke izikhangeli (ingakumbi, iChrome kwidesktop nakwiselfowuni).
Ingaba isebenza kanjani
Nantsi indlela ukuqinisekiswa kwefomu kusebenza ngayo ngeBootstrap:
- Uqinisekiso lwefom ye-HTML lusetyenziswa ngeeklasi ezimbini zobuxoki zeCSS,
:invalid
kunye :valid
. Isebenza kwi <input>
, <select>
, kunye <textarea>
neziqalelo.
- I-Bootstrap imida
:invalid
kunye :valid
nezimbo .was-validated
kwiklasi yabazali, ihlala isetyenziswa kwi <form>
. Kungenjalo, nayiphi na indawo efunekayo ngaphandle kwexabiso ibonisa njengengasebenziyo kumthwalo wephepha. Ngale ndlela, usenokukhetha ukuba zisebenze nini na (ngokwesiqhelo emva kokuba kuzanywa ukungenisa kwefomu).
- Ukusetha kwakhona inkangeleko yefom (umzekelo, kwimeko yokungeniswa kwefomu eguquguqukayo usebenzisa i-AJAX), susa
.was-validated
iklasi ukusuka <form>
kwakhona emva kokungeniswa.
- Njengomba wokubuyela umva,
.is-invalid
kwaye .is-valid
iiklasi zinokusetyenziswa endaweni yeeklasi zobuxoki zoqinisekiso lwecala lomncedisi . Abafuni .was-validated
klasi yabazali.
- Ngenxa yemiqobo kwindlela esebenza ngayo i-CSS, asinako (okwangoku) ukusebenzisa izitayile
<label>
kuleyo iza phambi kolawulo lwefom kwiDOM ngaphandle koncedo lweJavaScript yesiko.
- Zonke iiphequluli zanamhlanje zixhasa i- API yokuqinisekisa isithintelo , uthotho lweendlela zeJavaScript zokuqinisekisa ulawulo lwefom.
- Imiyalezo yengxelo inokusebenzisa isikhangeli esingagqibekanga (eyahlukileyo kumkhangeli zincwadi ngamnye, kwaye ayinasitayile ngokusebenzisa iCSS) okanye izimbo zethu zengxelo eyongezelelweyo ngeHTML kunye neCSS.
- Unokubonelela ngemiyalezo yokuqinisekisa ngokwesiko
setCustomValidity
kwiJavaScript.
Unaloo nto engqondweni, qwalasela ezi zidemo zilandelayo zeendlela zethu zokuqinisekisa ifom yesiko, iiklasi ezikhethiweyo zeseva, kunye nokungagqibekanga kwesikhangeli.
Izimbo zesiko
Kwimiyalezo yoqinisekiso lwendlela yeBootstrap yesiko, kuya kufuneka udibanise novalidate
uphawu lwe boolean kweyakho <form>
. Oku kuvala iingcebiso zesixhobo sengxelo yesikhangeli, kodwa isabonelela ngokufikelela kwifomu yoqinisekiso lweAPIs kwiJavaScript. Zama ukungenisa le fomu ingezantsi; yethu iJavaScript iya kuthintela iqhosha lokungenisa kwaye idlulisele ingxelo kuwe. Xa uzama ukungenisa, uya kubona iindlela :invalid
kunye :valid
nezimbo ezisetyenziswa kulawulo lwakho lwefom.
Izitayile zempendulo yesiko zisebenzisa imibala eqhelekileyo, imida, izimbo zokugxila, kunye neempawu ezingasemva ukunxibelelana ngcono ngengxelo. Imifanekiso engasemva ye <select>
s ifumaneka kuphela nge .custom-select
, kwaye hayi .form-control
.
Ukungagqibeki kwesikhangeli
Awunamdla kwimiyalezo yengxelo yokuqinisekisa okanye ukubhala iJavaScript ukutshintsha indlela yokuziphatha? Konke kulungile, ungasebenzisa ukungagqibeki kwesikhangeli. Zama ukuthumela le fomu ingezantsi. Ngokuxhomekeke kwisikhangeli sakho kunye ne-OS, uya kubona indlela eyahlukileyo kancinane yengxelo.
Ngelixa ezi zimbo zempendulo zingenako ukwenziwa ngesitayile ngeCSS, usenokwenza ngokwesiko lombhalo wengxelo ngeJavaScript.
Icala lomncedisi
Sicebisa ukuba kusetyenziswe ungqinisiso lwecala lomxhasi, kodwa xa ufuna uqinisekiso lwecala lomncedisi, ungabonisa iindawo ezingasebenziyo nezisebenzayo zefomu .is-invalid
kunye .is-valid
. Qaphela ukuba .invalid-feedback
ikwaxhaswa ngezi klasi.
Izinto ezixhaswayo
Izimbo zokuqinisekisa ziyafumaneka kolu lawulo lweefomu zilandelayo kunye namacandelo:
<input>
s kunye <textarea>
s kunye .form-control
(kubandakanya ukuya kwelinye .form-control
kumaqela egalelo)
<select>
s kunye .form-control
okanye.custom-select
.form-check
s
.custom-checkbox
s kunye no- .custom-radio
s
.custom-file
Ukuba uyilo lwefomu yakho luyakuvumela, ungatshintshanisa .{valid|invalid}-feedback
iiklasi .{valid|invalid}-tooltip
kwiiklasi ukubonisa ingxelo yokuqinisekisa kwisixhobo esinesitayile sesixhobo. Qinisekisa ukuba unomzali position: relative
ophezu kwayo ukuze abeke incam yesixhobo. Kulo mzekelo ungezantsi, iiklasi zethu zekholomu sezinayo le nto, kodwa iprojekthi yakho inokufuna enye indlela yokuseta.
Ukwenza ngokwezifiso
Iimeko zokuqinisekisa zingenziwa ngokwezifiso nge-Sass $form-validation-states
ngemephu. Ifakwe _variables.scss
kwifayile yethu, le mephu ye-Sass ijikelezwe ngaphezulu ukuze ivelise indawo engagqibekanga valid
/ invalid
yokuqinisekisa. Ibandakanyiwe yimephu ebekwe kwindlwane yokwenza umbala welizwe ngalinye kunye ne-icon. Ngelixa kungekho amanye amazwe axhaswa ngabakhangeli, abo basebenzisa izitayile zesiko banokongeza ngokulula ingxelo yefomu entsonkothileyo.
Nceda uqaphele ukuba asikucebisi ukwenza ezi xabiso ngaphandle kokuguqula kwakhona form-validation-state
umxube.
Ukuze wenze ngokwezifiso ngakumbi kunye nokuhambelana kwesikhangeli, sebenzisa izinto zethu zefom yesiko ngokupheleleyo ukuze ubuyisele ukusilela kwesikhangeli. Zakhelwe phezu kwesemantic kunye nophawu olufikelelekayo, ke zilutshintsho oluluqilima lwalo naluphi na ulawulo lwefom olungagqibekanga.
Iibhokisi zokutshekisha kunye noonomathotholo
Ibhokisi nganye yokukhangela kunye nerediyo <input>
kunye <label>
nokubhanqa zisongelwe kwi-a <div>
ukwenza ulawulo lwethu lwesiko. Ngokwesakhiwo, le yindlela efanayo neyethu engagqibekanga .form-check
.
Sisebenzisa umkhethi wabazalwana ( ~
) kuwo onke <input>
amazwe ethu-nje- :checked
ukulungisa ngokufanelekileyo isalathisi sethu sefom yesiko. Xa zidityaniswe .custom-control-label
neklasi, singenza kwakhona isimbo sokubhaliweyo kumba ngamnye ngokusekelwe <input>
kwimeko.
Sifihla okungagqibekanga <input>
kunye opacity
kwaye sisebenzise .custom-control-label
ukwakha isalathi sefomu yesiko esitsha endaweni yaso ::before
kunye ::after
. Ngelishwa asikwazi ukwakha isiko ukusuka nje <input>
ngenxa yokuba i-CSS content
ayisebenzi kuloo nto.
Kwiimeko ezikhangelweyo, sisebenzisa ii-icon ze-SVG ezizinzisiweyo ze-base64 ukusuka kwi- Open iconic . Oku kusinika olona lawulo lulungileyo lwesitayile kunye nokubeka kwindawo kuzo zonke iibhrawuza kunye nezixhobo.
Iibhokisi zokukhangela
Iibhokisi zokukhangela eziqhelekileyo zinokusebenzisa :indeterminate
udidi lwepseudo xa lucwangciswe ngesandla ngeJavaScript (akukho phawu loyelelwano lukhoyo lweHTML lokuyikhankanya).
Ukuba usebenzisa i-jQuery, into efana nale kufuneka yanele:
Oonomathotholo
Nomgca
Kukhubazekile
Iibhokisi zokukhangela ezilungiselelweyo kunye nonomathotholo nazo zinokucinywa. Yongeza disabled
uphawu lwe-boolean <input>
kunye nesalathisi esiqhelekileyo kunye nenkcazo yeleyibhile iya kwenziwa ngokuzenzekelayo.
Iiswitshi
Iswitshi inophawu lwebhokisi yokukhangela yesiko kodwa isebenzisa .custom-switch
iklasi ukunikezela iswitshi yokuguqula. Iiswitshi zikwaxhasa disabled
uphawu.
Iimenyu eziqhelekileyo <select>
zifuna kuphela iklasi yesiko, .custom-select
ukuqala izimbo zesiko. Izimbo zesiko <select>
zithintelwe kwinkangeleko yokuqala kwaye azinakuguqula i <option>
s ngenxa yothintelo lomkhangeli zincwadi.
Unokukhetha kwakhona kwizinto ezincinci kunye nezinkulu ezikhethiweyo ukuze utshatise amagalelo ethu okubhaliweyo alinganayo.
Uphawu multiple
loyelelwano lukwaxhaswa:
Njengoko bunjalo size
uphawu:
Uluhlu
Yenza <input type="range">
ulawulo lwesiko nge .custom-range
. Ingoma (imvelaphi) kunye nobhontsi (ixabiso) zombini zenziwe ngohlobo olufanayo kuzo zonke izikhangeli. Njengoko kuphela i-IE kunye neFirefox exhasa "ukugcwalisa" umkhondo wabo ukusuka ekhohlo okanye ekunene kubhontsi njengendlela yokubonisa inkqubela phambili, asiyixhasi okwangoku.
Uluhlu lwezimvo lunamaxabiso afihlakeleyo min
kunye max
- 0
kunye 100
, ngokulandelelanayo. Ungakhankanya amaxabiso amatsha kwabo basebenzisa i min
kunye max
neempawu.
Ngokungagqibekanga, amagalelo oluhlu "snap" ukuya kumaxabiso apheleleyo. Ukutshintsha oku, ungakhankanya step
ixabiso. Kulo mzekelo ungezantsi, siphinda kabini inani lamanyathelo ngokusebenzisa step="0.5"
.
Isikhangeli sefayile
Iplagi ecetyiswayo yokwenza uphilise igalelo lefayile yesiko: bs-custom-file-input , yile nto siyisebenzisayo ngoku apha kumaxwebhu ethu.
Igalelo lefayile lolona luhlu lunzima kwaye lufuna iJavaScript eyongezelelweyo ukuba ungathanda ukuzidibanisa nomsebenzi Khetha ifayile... kwaye ukhethiweyo wegama lefayile elibhaliweyo.
Sifihla ifayile engagqibekanga <input>
sisebenzisa opacity
kwaye endaweni yoko isitayile i <label>
. Iqhosha liyenziwa kwaye libekwe nge ::after
. Okokugqibela, sibhengeza u-a width
kunye height
nakwisithuba <input>
esifanelekileyo somxholo ongqongileyo.
Ukuguqulela okanye ukulungelelanisa imitya nge-SCSS
I :lang()
-pseudo-class isetyenziselwa ukuvumela uguqulelo lombhalo "Khangela" kwezinye iilwimi. Khipha ngaphezulu okanye yongeza amangeniso $custom-file-text
kuguqulo lweSass ngethegi yolwimi olufanelekileyo kunye neentambo zasekuhlaleni. Iintambo zesiNgesi zinokulungiswa ngendlela efanayo. Umzekelo, nantsi indlela umntu anokongeza ngayo inguqulelo yeSpanish (ikhowudi yolwimi lwesiSpanish ithi es
):
Nantsi lang(es)
intshukumo kwigalelo lefayile yesiko loguqulelo lwesiSpanish:
Kuya kufuneka usete ulwimi loxwebhu lwakho (okanye umthi ongezantsi walo) ngokuchanekileyo ukuze okubhaliweyo okuchanekileyo kuboniswe. Oku kunokwenziwa kusetyenziswa uphawu loyelelwano lang
lwesixhobo<html>
okanye isihloko se- Content-Language
HTTP , phakathi kwezinye iindlela.
Ukuguqulela okanye ukulungelelanisa imitya ngeHTML
I-Bootstrap ikwabonelela ngendlela yokuguqulela "Khangela" okubhaliweyo kwi-HTML kunye data-browse
nophawu olunokongezwa kwileyibhile yegalelo eliqhelekileyo (umzekelo ngesiDatshi):