CSS
Zokonda zapadziko lonse lapansi za CSS, zinthu zofunika kwambiri za HTML zosinthidwa ndikusinthidwa ndi makalasi okulirapo, komanso makina apamwamba kwambiri a gridi.
Zokonda zapadziko lonse lapansi za CSS, zinthu zofunika kwambiri za HTML zosinthidwa ndikusinthidwa ndi makalasi okulirapo, komanso makina apamwamba kwambiri a gridi.
Pezani zotsika pazida zazikulu za zomangamanga za Bootstrap, kuphatikiza njira yathu yopangira mawebusayiti abwinoko, othamanga, amphamvu.
Bootstrap imagwiritsa ntchito zinthu zina za HTML ndi CSS zomwe zimafuna kugwiritsa ntchito HTML5 doctype. Phatikizanipo kumayambiriro kwa ntchito zanu zonse.
Ndi Bootstrap 2, tawonjezera masitayelo okonda mafoni pazinthu zazikulu za chimango. Ndi Bootstrap 3, talembanso pulojekitiyi kuti ikhale yothandizana ndi mafoni kuyambira pachiyambi. M'malo mowonjezera masitayelo am'manja, amawotchedwa pachimake. M'malo mwake, Bootstrap ndi foni yoyamba . Masitayilo oyambira am'manja atha kupezeka mulaibulale yonse m'malo mwa mafayilo osiyana.
Kuti muwonetsetse kumasulira koyenera ndi kukhudza kukulitsa, onjezani meta tag yowonera pa <head>
.
Mutha kuletsa zooming pazida zam'manja powonjezera user-scalable=no
pa meta tag yowonera. Izi zimalepheretsa kuyang'ana, kutanthauza kuti ogwiritsa ntchito amatha kusuntha, ndipo zimapangitsa kuti tsamba lanu lizimva ngati pulogalamu yanu. Ponseponse, sitikupangira izi patsamba lililonse, chifukwa chake samalani!
Bootstrap imayika mawonedwe oyambira padziko lonse lapansi, typography, ndi masitayilo a ulalo. Makamaka, ife:
background-color: #fff;
pabody
@font-family-base
, @font-size-base
, ndi mawonekedwe @line-height-base
monga typographic maziko athu@link-color
ndikugwiritsa ntchito mizere ya ulalo pokha:hover
Masitayelo awa amapezeka mkati scaffolding.less
.
Pakumasulira kopitilira muyeso, timagwiritsa ntchito Normalize.css , pulojekiti ya Nicolas Gallagher ndi Jonathan Neal .
Bootstrap imafuna chinthu chomwe chili ndi chinthu kuti chimangire zomwe zili patsamba ndikukhazikitsa gridi yathu. Mutha kusankha chimodzi mwazotengera ziwiri zomwe mungagwiritse ntchito pamapulojekiti anu. Dziwani kuti, chifukwa padding
ndi zina, palibe chidebe chomwe chili ndi nestable.
Gwiritsani .container
ntchito chidebe chomvera chokhazikika chokhazikika.
Gwiritsani .container-fluid
ntchito chidebe chokulirapo chathunthu, kutengera m'lifupi lonse la malo anu owonera.
Bootstrap imaphatikizapo makina omvera, oyambira oyambira amadzimadzi omwe amafika pamizere 12 pomwe chipangizocho kapena kukula kwa malo owonera kumachulukira. Zimaphatikizapo makalasi okonzedweratu kuti asankhe masanjidwe osavuta, komanso zosakaniza zamphamvu zopangira masanjidwe ambiri a semantic .
Makina opangira ma gridi amagwiritsidwa ntchito popanga masanjidwe amasamba kudzera mumizere ingapo ndi mizati yomwe imasunga zomwe zili zanu. Umu ndi momwe dongosolo la grid Bootstrap limagwirira ntchito:
.container
(m'lifupi-wokhazikika) kapena .container-fluid
(m'lifupi-wonse) kuti muyanitse bwino ndi zomatira..row
ndipo .col-xs-4
akupezeka kuti apange masanjidwe a gridi mwachangu. Zosakaniza zocheperako zitha kugwiritsidwanso ntchito pamasanjidwe ambiri a semantic.padding
. Padding imeneyo imasinthidwa m'mizere yoyambira ndi yomaliza kudzera m'mphepete mwa .row
s..col-xs-4
..col-md-*
kalasi iliyonse ku chinthu sichidzangokhudza makongoletsedwe ake pazida zapakatikati komanso pazida zazikulu ngati .col-lg-*
kalasi palibe.Yang'anani ku zitsanzo zogwiritsira ntchito mfundozi pa code yanu.
Timagwiritsa ntchito mafunso otsatirawa pamafayilo athu Ocheperako kuti tipange ma breakpoints mu grid system yathu.
Nthawi zina timafutukula mafunso awa kuti aphatikize a max-width
kuchepetsa CSS ku zida zocheperako.
Onani momwe machitidwe a gridi ya Bootstrap amagwirira ntchito pazida zingapo zokhala ndi tebulo lothandizira.
Mafoni ang'onoang'ono (<768px) | Mapiritsi ang'onoang'ono (≥768px) | Ma Desktop a zida zapakatikati ( ≥992px ) | Zida Zazida zazikulu (≥1200px) | |
---|---|---|---|---|
Khalidwe la grid | Yopingasa nthawi zonse | Yagubuduzika kuti iyambike, yopingasa pamwamba pa zopingasa | ||
M'lifupi mwake | Palibe (yokha) | 750px | 970px pa | 1170px |
Chiyambi cha kalasi | .col-xs- |
.col-sm- |
.col-md- |
.col-lg- |
# ya mizati | 12 | |||
M'lifupi mwake | Zadzidzidzi | ~62px | ~81px | ~97px |
Kuchuluka kwa ngalande | 30px (15px mbali iliyonse ya ndime) | |||
Nestable | Inde | |||
Zowonongeka | Inde | |||
Kuyitanitsa ndindalama | Inde |
Pogwiritsa ntchito gulu limodzi .col-md-*
lamagulu agululi, mutha kupanga makina oyambira omwe amayambira pazida zam'manja ndi zida zam'manja (zocheperako mpaka zazing'ono) zisanakhale zopingasa pakompyuta (zapakatikati). Ikani magawo a gridi iliyonse .row
.
Sinthani masanjidwe aliwonse amtundu wa gridi kukhala m'lifupi mwake mwakusintha mawonekedwe anu akunja .container
kukhala .container-fluid
.
Kodi simukufuna kuti mizati yanu ingowunjika muzida zing'onozing'ono? Gwiritsani ntchito makalasi owonjezera ang'onoang'ono ndi apakatikati powonjezera pamindandanda .col-xs-*
.col-md-*
yanu. Onani chitsanzo pansipa kuti mudziwe bwino momwe zonsezi zimagwirira ntchito.
Mangani pa chitsanzo cham'mbuyomu popanga masanjidwe amphamvu kwambiri komanso amphamvu okhala ndi .col-sm-*
makalasi a piritsi.
Ngati mizati yopitilira 12 yayikidwa pamzere umodzi, gulu lirilonse la zigawo zowonjezera, ngati gawo limodzi, likulungidwa pamzere watsopano.
Ndi magawo anayi a ma gridi omwe alipo, mutha kukumana ndi zovuta zomwe, nthawi zina, mizati yanu siyimveka bwino chifukwa imodzi ndi yayitali kuposa inzake. Kuti mukonze izi, gwiritsani ntchito kuphatikiza a ndi makalasi.clearfix
athu ofunikira omvera .
Kuphatikiza pa kukonza magawo pazigawo zongoyankha, mungafunike kukonzanso zosinthira, zokankhira, kapena zokoka . Onani izi muzochitika mu grid chitsanzo .
Sunthani mizati kumanja pogwiritsa ntchito .col-md-offset-*
makalasi. Makalasi awa amawonjezera malire akumanzere kwa gawo ndi magawo *
. Mwachitsanzo, .col-md-offset-4
amasuntha .col-md-4
mizati inayi.
Muthanso kupitilira zosinthika kuchokera pamagulu otsika a gridi ndi .col-*-offset-0
makalasi.
Kuti mutsegule zomwe zili ndi gridi yokhazikika, onjezani magawo atsopano .row
ndi magulu omwe ali .col-sm-*
mgulu lomwe lilipo .col-sm-*
. Mizere yokhazikitsidwa iyenera kukhala ndi magawo 12 kapena kucheperapo (sikufunika kuti mugwiritse ntchito magawo 12 onse omwe alipo).
Sinthani mosavuta dongosolo lamagulu athu omangidwira mkati ndi .col-md-push-*
makalasi .col-md-pull-*
osintha.
Kuphatikiza pa makalasi a gridi omangidwiratu kuti amasanjidwe mwachangu, Bootstrap imaphatikizanso Zocheperako ndi zosakaniza kuti mupange mwachangu masanjidwe anu osavuta, a semantic.
Zosintha zimatsimikizira kuchuluka kwa mizati, m'lifupi mwa ngalande, ndi malo ochezera a pawailesi pomwe amayambira mizati yoyandama. Timagwiritsa ntchito izi kupanga makalasi a gridi omwe afotokozedwa pamwambapa, komanso zosakaniza zomwe zalembedwa pansipa.
Mixins amagwiritsidwa ntchito molumikizana ndi ma gridi osiyanasiyana kuti apange CSS ya semantic pamizere ya gridi iliyonse.
Mutha kusintha zosinthika kukhala zomwe mumakonda, kapena ingogwiritsani ntchito zosakaniza zomwe zili ndi zikhalidwe zawo. Nachi chitsanzo chogwiritsa ntchito zosintha zosasinthika kuti mupange masanjidwe a magawo awiri okhala ndi kusiyana pakati.
Mitu yonse ya HTML, <h1>
kupyolera mu <h6>
, ilipo. .h1
kudzera .h6
m'makalasi amapezekanso, chifukwa mukafuna kufananiza masitayilo amutu koma mukufunabe kuti mawu anu aziwonetsedwa pamzere.
h1 ndi. Mutu wa bootstrap |
Semibold 36px |
h2 ndi. Mutu wa bootstrap |
Semibold 30px |
h3 ndi. Mutu wa bootstrap |
Semibold 24px |
h4 ndi. Mutu wa bootstrap |
Semibold 18px |
h5 ndi. Mutu wa bootstrap |
Semibold 14px |
h6 ndi. Mutu wa bootstrap |
Semibold 12px |
Pangani mawu opepuka, achiwiri pamutu uliwonse wokhala ndi <small>
tag yachidule kapena .small
kalasi.
h1 ndi. Mutu wa bootstrap Mawu achiwiri |
h2 ndi. Mutu wa bootstrap Mawu achiwiri |
h3 ndi. Mutu wa bootstrap Mawu achiwiri |
h4 ndi. Mutu wa bootstrap Mawu achiwiri |
h5 ndi. Mutu wa bootstrap Mawu achiwiri |
h6 ndi. Mutu wa bootstrap Mawu achiwiri |
Kusakhazikika kwapadziko lonse kwa Bootstrap font-size
ndi 14px , yokhala line-height
ndi 1.428 . Izi zikugwiritsidwa ntchito ku <body>
ndime zonse. Kuphatikiza apo, <p>
(ndime) zimalandira malire apakati a theka la kutalika kwa mzere wawo (10px mwachisawawa).
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. Donec ullamcorper nulla non metus auctor fringilla. Ndife mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Donec ullamcorper nulla non metus auctor fringilla.
Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id ili si mi porta gravida ndi eget metus. Ndife mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit.
Pangani ndime kukhala yodziwika bwino powonjezera .lead
.
Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Chifukwa chake, si commodo luctus.
Sikelo ya typographic imachokera pazigawo ziwiri Zochepa mu variables.less : @font-size-base
ndi @line-height-base
. Choyamba ndi kukula kwa font komwe kumagwiritsidwa ntchito ponsepo ndipo chachiwiri ndi kutalika kwa mzere woyambira. Timagwiritsa ntchito masinthidwe amenewo ndi masamu osavuta kupanga mizere, ma padding, ndi kutalika kwa mzere wamitundu yathu yonse ndi zina zambiri. Sinthani Mwamakonda Anu ndikusintha kwa Bootstrap.
Kuti muwonetse kuchuluka kwa mawu chifukwa cha kufunikira kwake munkhani ina, gwiritsani ntchito <mark>
tag.
Mutha kugwiritsa ntchito chizindikirocho kutiwunikiranimawu.
Kuti muwonetse zolemba zomwe zachotsedwa gwiritsani ntchito <del>
tag.
Mzerewu walemba uyenera kutengedwa ngati malemba ochotsedwa.
Kuti muwonetse mabulogu omwe sali ofunikira gwiritsani ntchito <s>
tag.
Mzerewu uyenera kuwonedwa ngati wosalondola.
Kuti muwonetse zowonjezera pa chikalatacho gwiritsani ntchito <ins>
tag.
Mzerewu walemba uyenera kutengedwa ngati chowonjezera pa chikalatacho.
Kuti mutsindikire mawu gwiritsani ntchito <u>
tag.
Mzere wa mawuwa uwonetsa ngati watsindikira
Gwiritsani ntchito ma tag otsindika a HTML okhala ndi masitayelo opepuka.
Kuti musatsindike pakati kapena midadada ya mawu, gwiritsani ntchito <small>
chizindikirocho kuti muyike mawu pa 85% kukula kwa kholo. Mitu yamutu imalandira yawoyawo font-size
pazinthu zomwe zasungidwa <small>
.
Mutha kugwiritsa ntchito chinthu chamkati .small
m'malo mwa chilichonse <small>
.
Mzere wa mawu awa akuyenera kuwonedwa ngati kusindikizidwa bwino.
Kuti mutsindike kachidutswa kakang'ono ka zilembo zolemera mafonti.
Kaduka kakang'ono kotsatira kamene kali ndi mawu akuda kwambiri .
Potsindika kaduka kakang'ono ka mawu okhala ndi mawu opendekera.
Kaduka kakang'ono kotsatira kalembedwe ka mawu opendekera .
Khalani omasuka kugwiritsa ntchito <b>
komanso <i>
mu HTML5. <b>
cholinga chake ndi kuwunikira mawu kapena ziganizo popanda kuwonetsa kufunikira kowonjezera pomwe <i>
nthawi zambiri zimakhala za mawu, mawu aukadaulo, ndi zina.
Sinthani mawu mosavuta ku zigawo zokhala ndi makalasi oyika mawu.
Mawu olowera kumanzere.
Mawu olumikizidwa pakati.
Mawu olowera kumanja.
Mawu ovomerezeka.
Palibe zolemba.
Sinthani mawu kukhala zigawo ndi makalasi a zilembo zazikulu.
Mawu ocheperako.
Mawu apamwamba.
Zolemba zazikulu.
Kukhazikitsa kosinthika kwazinthu za HTML <abbr>
zofupikitsa ndi ma acronyms kuti awonetse mtundu wokulitsidwa pa hover. Mawu achidule okhala ndi tanthauzo title
ali ndi malire apansi a madontho opepuka komanso cholozera chothandizira pa hover, zomwe zimapereka mawu owonjezera pa hover ndi kwa ogwiritsa ntchito matekinoloje othandizira.
Chidule cha mawu akuti attr .
Onjezani .initialism
ku chidule cha kukula kwa mawonekedwe ang'onoang'ono.
HTML ndiye chinthu chabwino kwambiri kuyambira mkate wodulidwa.
Perekani zidziwitso za makolo apafupi kapena gulu lonse lantchito. Sungani masanjidwe pomaliza mizere yonse ndi <br>
.
Kuti mugwire mawu midadada kuchokera kugwero lina mkati mwazolemba zanu.
Mangirirani HTML<blockquote>
iliyonse ngati mawu. Kwa mawu olunjika, timalimbikitsa a .<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere ndi ante.
Kusintha kwa masitayelo ndi zomwe zili pakusintha kosavuta pamiyezo <blockquote>
.
Onjezani a <footer>
kuti muzindikire kochokera. Manga dzina la gwero ntchito mu <cite>
.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere ndi ante.
Onjezani .blockquote-reverse
ku blockquote yokhala ndi zolondola.
Mndandanda wazinthu zomwe dongosololi lilibe kanthu .
Mndandanda wazinthu zomwe dongosololi limafunikira momveka bwino.
Chotsani malire okhazikika list-style
ndi akumanzere pazida zamndandanda (ana apompopompo okha). Izi zimagwiranso ntchito pa mndandanda wazinthu zomwe zangotsala pang'ono za ana , kutanthauza kuti mudzafunikanso kuwonjezera kalasi pamndandanda uliwonse womwe wasungidwa.
Ikani zinthu zonse pamndandanda umodzi wokhala display: inline-block;
ndi zotchingira zowala.
Mndandanda wa mawu omwe ali ndi mafotokozedwe ogwirizana nawo.
Pangani mawu ndi mafotokozedwe <dl>
motsatira mbali ndi mbali. Imayamba kumangika ngati kusakhazikika <dl>
s, koma navbar ikakula, chitani izi.
Mafotokozedwe opingasa adzafupikitsa mawu omwe ndi aatali kwambiri kuti asakwane kumanzere ndi text-overflow
. Pamalo ocheperako, asintha kukhala mawonekedwe osakhazikika.
Manga zilembo zam'munsi zamakhodi ndi <code>
.
<section>
iyenera kukulungidwa ngati inline.
Gwiritsani ntchito <kbd>
kuwonetsa zolowetsa zomwe nthawi zambiri zimalowetsedwa kudzera pa kiyibodi.
Gwiritsani <pre>
ntchito mizere ingapo yamakhodi. Onetsetsani kuti mwathawa m'mabokosi aliwonse mu code kuti mumasulire bwino.
<p>Zitsanzo zalemba apa...</p>
Mutha kuwonjezera .pre-scrollable
kalasi, yomwe ingakhazikitse kutalika kwa 350px ndikupereka y-axis scrollbar.
Kuti muwonetse zosinthika gwiritsani ntchito <var>
tag.
y = mx + b _
Kuti muwonetse midadada yotuluka kuchokera ku pulogalamu gwiritsani ntchito <samp>
tag.
Mawuwa akuyenera kutengedwa ngati chitsanzo chotuluka pakompyuta.
Pamakongoletsedwe oyambira - zotchingira zopepuka komanso zogawa zopingasa zokha - onjezerani gulu loyambira .table
ku chilichonse <table>
. Zitha kuwoneka ngati zosafunikira, koma chifukwa cha kufalikira kwa matebulo a mapulagini ena monga makalendala ndi osankha masiku, tasankha kudzipatula masitaelo athu a tebulo.
# | Dzina loyamba | Dzina lomaliza | Dzina lolowera |
---|---|---|---|
1 | Mark | Otto | @mdo |
2 | Yakobo | Thornton | @mafuta |
3 | Larry | Mbalame |
Gwiritsani .table-striped
ntchito kuwonjezera mbidzi-mizere pamzere uliwonse wa tebulo mkati mwa <tbody>
.
Matebulo amizere amapangidwa kudzera pa :nth-child
chosankha cha CSS, chomwe sichipezeka mu Internet Explorer 8.
# | Dzina loyamba | Dzina lomaliza | Dzina lolowera |
---|---|---|---|
1 | Mark | Otto | @mdo |
2 | Yakobo | Thornton | @mafuta |
3 | Larry | Mbalame |
Onjezani .table-bordered
malire kumbali zonse za tebulo ndi ma cell.
# | Dzina loyamba | Dzina lomaliza | Dzina lolowera |
---|---|---|---|
1 | Mark | Otto | @mdo |
2 | Yakobo | Thornton | @mafuta |
3 | Larry | Mbalame |
Onjezani .table-hover
kuti mutsegule chiwongolero pamizere ya tebulo mkati mwa <tbody>
.
# | Dzina loyamba | Dzina lomaliza | Dzina lolowera |
---|---|---|---|
1 | Mark | Otto | @mdo |
2 | Yakobo | Thornton | @mafuta |
3 | Larry | Mbalame |
Onjezani .table-condensed
kuti ma tebulo azikhala ophatikizika podula ma cell padding pakati.
# | Dzina loyamba | Dzina lomaliza | Dzina lolowera |
---|---|---|---|
1 | Mark | Otto | @mdo |
2 | Yakobo | Thornton | @mafuta |
3 | Larry Mbalame |
Gwiritsani ntchito makalasi okhazikika kuti musankhe mizere yamatebulo kapena ma cell amodzi.
Kalasi | Kufotokozera |
---|---|
.active |
Imayika mtundu wa hover pa mzere kapena selo linalake |
.success |
Imawonetsa kuchita bwino kapena koyenera |
.info |
Imawonetsa kusintha kosalowerera ndale kapena zochita |
.warning |
Limasonyeza chenjezo limene lingafunike chisamaliro |
.danger |
Imawonetsa zochitika zowopsa kapena zoyipa |
# | Mutu wagawo | Mutu wagawo | Mutu wagawo |
---|---|---|---|
1 | Zamkatimu | Zamkatimu | Zamkatimu |
2 | Zamkatimu | Zamkatimu | Zamkatimu |
3 | Zamkatimu | Zamkatimu | Zamkatimu |
4 | Zamkatimu | Zamkatimu | Zamkatimu |
5 | Zamkatimu | Zamkatimu | Zamkatimu |
6 | Zamkatimu | Zamkatimu | Zamkatimu |
7 | Zamkatimu | Zamkatimu | Zamkatimu |
8 | Zamkatimu | Zamkatimu | Zamkatimu |
9 | Zamkatimu | Zamkatimu | Zamkatimu |
Kugwiritsa ntchito mtundu kuti muwonjezere tanthauzo pamizere ya tebulo kapena selo la munthu aliyense kumangopereka chizindikiritso, chomwe sichidzaperekedwa kwa ogwiritsa ntchito matekinoloje othandizira - monga zowerengera zowonera. Onetsetsani kuti chidziwitso cha mtunduwo ndi chodziwikiratu kuchokera pazomwe zili (zolemba zowonekera mumzere wa tebulo/selo), kapena zikuphatikizidwa ndi njira zina, monga zolemba zina zobisika ndi .sr-only
kalasi.
Pangani matebulo omvera mwa kukulunga chilichonse .table
kuti .table-responsive
azitha kuyenda mozungulira pazida zing'onozing'ono (pansi pa 768px). Mukawona chilichonse chokulirapo kuposa 768px, simudzawona kusiyana kulikonse pamatebulo awa.
Matebulo omvera amagwiritsa ntchito overflow-y: hidden
, yomwe imadula chilichonse chomwe chimadutsa pansi kapena m'mphepete mwa tebulo. Makamaka, izi zitha kudulira mindandanda yotsitsa ndi ma widget ena a chipani chachitatu.
Firefox ili ndi masitayelo ovuta width
omwe amasokoneza tebulo loyankha. Izi sizingalephereke popanda kuthyolako kwa Firefox komwe sitipereka mu Bootstrap:
Kuti mudziwe zambiri, werengani yankho la Stack Overflow iyi .
# | Mutu wapatebulo | Mutu wapatebulo | Mutu wapatebulo | Mutu wapatebulo | Mutu wapatebulo | Mutu wapatebulo |
---|---|---|---|---|---|---|
1 | Table cell | Table cell | Table cell | Table cell | Table cell | Table cell |
2 | Table cell | Table cell | Table cell | Table cell | Table cell | Table cell |
3 | Table cell | Table cell | Table cell | Table cell | Table cell | Table cell |
# | Mutu wapatebulo | Mutu wapatebulo | Mutu wapatebulo | Mutu wapatebulo | Mutu wapatebulo | Mutu wapatebulo |
---|---|---|---|---|---|---|
1 | Table cell | Table cell | Table cell | Table cell | Table cell | Table cell |
2 | Table cell | Table cell | Table cell | Table cell | Table cell | Table cell |
3 | Table cell | Table cell | Table cell | Table cell | Table cell | Table cell |
Kuwongolera mawonekedwe amunthu payekha kumangolandira masitayelo apadziko lonse lapansi. Zonse zolembedwa <input>
, <textarea>
, ndi <select>
zinthu zomwe .form-control
zili nazo zimakhazikitsidwa width: 100%;
mwachisawawa. Mangani zilembo ndi zowongolera .form-group
kuti mutalikirane bwino.
Osasakaniza magulu amagulu mwachindunji ndi magulu olowa . M'malo mwake, sungani gulu lolowera mkati mwa gulu la mawonekedwe.
Onjezani .form-inline
ku fomu yanu (yomwe sikuyenera kukhala a <form>
) pazowongolera zolowera kumanzere komanso zopingasa pamzere. Izi zimangokhudza mafomu omwe ali mkati mwa mawonedwe omwe ali osachepera 768px m'lifupi.
Zolowetsa ndi zosankhidwa zagwiritsidwa width: 100%;
ntchito mwachisawawa mu Bootstrap. M'mawonekedwe apaintaneti, timayikanso kuti width: auto;
maulamuliro angapo amatha kukhala pamzere womwewo. Kutengera masanjidwe anu, makulidwe owonjezera owonjezera angafunike.
Owerenga pazenera adzakhala ndi vuto ndi mafomu anu ngati simuphatikiza zilembo zilizonse. Pama fomu apaintaneti, mutha kubisa zilembozo pogwiritsa ntchito .sr-only
kalasi. Palinso njira zina zoperekera chizindikiro chaukadaulo wothandizira, monga aria-label
, aria-labelledby
kapena mawonekedwe title
. Ngati palibe chimodzi mwa izi, owerenga skrini amatha kugwiritsa ntchito mawonekedwewo placeholder
, ngati alipo, koma dziwani kuti kugwiritsa placeholder
ntchito m'malo mwa njira zina zolembera sikulangizidwa.
Gwiritsani ntchito makalasi a gululi omwe afotokozedwa kale a Bootstrap kuti mugwirizane ndi zilembo ndi magulu a zowongolera munjira yopingasa powonjezera .form-horizontal
mawonekedwe (omwe sakuyenera kukhala <form>
). Kuchita izi kumasintha .form-group
kukhala ngati mizere ya gridi, kotero palibe chifukwa cha .row
.
Zitsanzo za maulamuliro amtundu wokhazikika omwe amathandizidwa mu mawonekedwe achitsanzo.
Nthawi zambiri mawonekedwe owongolera, magawo otengera mawu. Mulinso chithandizo chamitundu yonse ya HTML5: text
, password
, datetime
, datetime-local
, date
, month
, time
, week
, number
, email
, url
, search
, tel
, ndi color
.
Zolowetsa zidzasinthidwa kwathunthu ngati zalengezedwa type
bwino.
Kuti muwonjezere mawu ophatikizika kapena mabatani musanayambe komanso/kapena pambuyo pa mawu aliwonse <input>
, onani gawo la gulu lolowera .
Kuwongolera mafomu komwe kumathandizira mizere ingapo yamalemba. Sinthani rows
mawonekedwe ngati pakufunika.
Mabokosi amasankha chimodzi kapena zingapo pamndandanda, pomwe mawayilesi ndi osankha njira imodzi kuchokera ambiri.
Mabokosi oyendera ndi mawayilesi olemala amathandizidwa, koma kuti mupereke cholozera "chosaloledwa" pa hover ya kholo <label>
, mufunika kuwonjezera .disabled
kalasi ku kholo .radio
, .radio-inline
, .checkbox
, kapena .checkbox-inline
.
Gwiritsani ntchito .checkbox-inline
kapena .radio-inline
makalasi pamabokosi angapo kapena mawayilesi pazowongolera zomwe zimawonekera pamzere womwewo.
Ngati mulibe mawu mkati mwa <label>
, zolowetsazo zimakhala momwe mukuyembekezera. Pakali pano imagwira ntchito pamabokosi ndi mawayilesi omwe sali pa intaneti. Kumbukirani kuperekabe mtundu wina wa zilembo zamatekinoloje othandizira (mwachitsanzo, kugwiritsa ntchito aria-label
).
Zindikirani kuti makonda ambiri omwe amasankhidwa - omwe ali mu Safari ndi Chrome - ali ndi ngodya zozungulira zomwe sizingasinthidwe kudzera pa border-radius
katundu.
Pazowongolera <select>
zomwe zili ndi mawonekedwe multiple
, zosankha zingapo zimawonetsedwa mwachisawawa.
Mukafuna kuyika mawu osamveka bwino pafupi ndi chilembo cha fomu, gwiritsani ntchito .form-control-static
kalasi pa <p>
.
Timachotsa outline
masitayelo okhazikika paziwongolero zamitundu box-shadow
ndikuyika a m'malo mwake :focus
.
:focus
stateZomwe zili pamwambazi zimagwiritsa ntchito masitayelo anthawi zonse muzolemba zathu kuwonetsa :focus
dziko pa .form-control
.
Onjezani mawonekedwe a disabled
boolean pazolowetsa kuti mupewe kuyanjana kwa ogwiritsa ntchito. Zolowera zolemala zimawoneka zopepuka ndikuwonjezera not-allowed
cholozera.
Onjezani zomwe zili disabled
ku a <fieldset>
kuti muletse zowongolera zonse zomwe zili mkati mwa <fieldset>
nthawi imodzi.
<a>
Mwachikhazikitso, asakatuli azitha kuyang'anira mawonekedwe onse ( <input>
, <select>
ndi <button>
zinthu) mkati <fieldset disabled>
mwazolephereka, kulepheretsa kuyanjana kwa kiyibodi ndi mbewa pa iwo. Komabe, ngati mawonekedwe anu alinso ndi <a ... class="btn btn-*">
zinthu, izi zidzangopatsidwa kalembedwe ka pointer-events: none
. Monga taonera m'chigawo chokhudza anthu olumala a mabatani (ndipo makamaka mugawo laling'ono la nangula), katundu wa CSS sanakhazikitsidwebe ndipo sakuthandizidwa mokwanira mu Opera 18 ndi pansi, kapena mu Internet Explorer 11, ndipo adapambana. 'Letsani ogwiritsa ntchito kiyibodi kuti azitha kuyang'ana kapena kuyambitsa maulalo awa. Chifukwa chake kuti mukhale otetezeka, gwiritsani ntchito JavaScript kuti mulepheretse maulalo oterowo.
Ngakhale Bootstrap idzagwiritsa ntchito masitayelo awa mu asakatuli onse, Internet Explorer 11 ndi pansipa sizigwirizana ndi disabled
mawonekedwe a <fieldset>
. Gwiritsani ntchito JavaScript yokhazikika kuti muyimitse gawo la asakatuli awa.
Onjezani mawonekedwe a readonly
boolean pazolowetsa kuti mupewe kusintha kwa mtengo wake. Zolowetsa zowerengera zokha zimawoneka zopepuka (monga zolowetsa zozimitsidwa), koma sungani cholozera chokhazikika.
Mawu othandizira mulingo wa block pazowongolera mawonekedwe.
Mawu othandizira akuyenera kulumikizidwa momveka bwino ndi mawonekedwe omwe akukhudzana ndi kugwiritsa ntchito mawonekedwe aria-describedby
. Izi ziwonetsetsa kuti matekinoloje othandizira - monga owerenga skrini - adzalengeza mawu othandizira pamene wogwiritsa ntchito akuyang'ana kapena alowa mu ulamuliro.
Bootstrap imaphatikizapo masitayelo ovomerezeka a zolakwika, chenjezo, ndikuchita bwino pakuwongolera mawonekedwe. Kuti mugwiritse ntchito, kuwonjezera .has-warning
, .has-error
, kapena .has-success
kuzinthu zamakolo. Any .control-label
, .form-control
, ndipo .help-block
mkati mwa chinthucho adzalandira masitaelo ovomerezeka.
Kugwiritsa ntchito masitayelo otsimikizirawa kuti awonetse momwe mawonekedwe akuwongolera kumangopereka chiwonetsero chamitundu, chomwe sichidzaperekedwa kwa ogwiritsa ntchito matekinoloje othandizira - monga owerenga skrini - kapena kwa ogwiritsa ntchito osaona.
Onetsetsani kuti palinso chisonyezero cha dziko. Mwachitsanzo, mutha kuphatikizirapo malingaliro okhudza momwe zinthu zilili m'mawu owongolera ( <label>
monga momwe zilili pachitsanzo chotsatirachi), phatikizani Glyphicon (ndi mawu ena oyenerera pogwiritsa ntchito .sr-only
kalasi - onani zitsanzo za Glyphicon ), kapena popereka Thandizo lothandizira malemba block. Makamaka pamakina othandizira, zowongolera zosavomerezeka zitha kuperekedwanso mawonekedwe aria-invalid="true"
.
Mutha kuwonjezeranso zithunzi zomwe mwasankha ndikuwonjezera .has-feedback
ndi chithunzi choyenera.
Zithunzi zoyankha zimangogwira ntchito ndi zolemba <input class="form-control">
.
Kuyika pamanja pazithunzi za mayankho ndikofunikira pazolowetsa zopanda zilembo komanso magulu omwe ali ndi zowonjezera kumanja. Mukulimbikitsidwa kuti mupereke zilembo pazolowetsa zonse pazifukwa zopezeka. Ngati mukufuna kuti zilembo zisawonetsedwe, zibiseni ndi .sr-only
kalasi. Ngati mukuyenera kutero popanda zilembo, sinthani top
kufunikira kwa chithunzi cha mayankho. Pamagulu olowetsa, sinthani right
mtengowo kukhala mtengo woyenerera wa pixel kutengera kukula kwa addon yanu.
Kuwonetsetsa kuti matekinoloje othandizira - monga zowerengera zowonera - akupereka tanthauzo lachizindikiro molondola, mawu owonjezera obisika ayenera kuphatikizidwa ndi .sr-only
kalasi ndikulumikizidwa momveka bwino ndi mawonekedwe omwe amagwirizana nawo aria-describedby
. Kapenanso, onetsetsani kuti tanthauzo (mwachitsanzo, kuti pali chenjezo la gawo linalake lolowera) limaperekedwa mwanjira ina, monga kusintha mawu enieni <label>
okhudzana ndi kuwongolera mawonekedwe.
Ngakhale zitsanzo zotsatirazi zikutchula kale za kutsimikizika kwa mawonekedwe awo omwe amawongolera <label>
m'malemba omwewo, njira yomwe ili pamwambayi (pogwiritsa ntchito .sr-only
malemba ndi aria-describedby
) yaphatikizidwa kuti iwonetsere.
.sr-only
zilembo zobisikaNgati mugwiritsa ntchito .sr-only
kalasi kubisa mawonekedwe owongolera <label>
(m'malo mogwiritsa ntchito zina zolembera, monga mawonekedwe aria-label
), Bootstrap imangosintha mawonekedwe a chithunzicho chikawonjezedwa.
Khazikitsani utali pogwiritsa ntchito makalasi monga .input-lg
, ndipo ikani m'lifupi pogwiritsa ntchito makalasi amtundu wa grid monga .col-lg-*
.
Pangani zowongolera zazitali kapena zazifupi zomwe zimagwirizana ndi kukula kwa mabatani.
Kukula mwachangu zilembo ndikuwongolera mawonekedwe mkati .form-horizontal
mwa kuwonjezera .form-group-lg
kapena .form-group-sm
.
Manga zolowa m'magawo a gridi, kapena chinthu chilichonse cha makolo, kuti mutsirize kukula komwe mukufuna.
Gwiritsani ntchito batani la makalasi pa <a>
, <button>
, kapena<input>
element.
Ngakhale makalasi a mabatani amatha kugwiritsidwa ntchito <a>
ndi <button>
zinthu, zinthu zokha <button>
ndizomwe zimathandizidwa mkati mwa nav ndi navbar.
Ngati <a>
zinthuzo zikugwiritsidwa ntchito ngati mabatani - kuyambitsa ntchito zapatsamba, m'malo mopita ku chikalata china kapena gawo lomwe lili mkati mwa tsamba lamakono - ayeneranso kupatsidwa zoyenera role="button"
.
Monga njira yabwino kwambiri, timalimbikitsa kugwiritsa ntchito <button>
chinthucho ngati kuli kotheka kuti mutsimikizire kuti zikugwirizana ndi mawonekedwe akusakatula.
Mwa zina, pali cholakwika mu Firefox <30 chomwe chimatilepheretsa kukhazikitsa mabatani line-height
a <input>
-based, kuwapangitsa kuti asafanane ndi kutalika kwa mabatani ena pa Firefox.
Gwiritsani ntchito mabatani aliwonse omwe alipo kuti mupange batani losinthidwa mwachangu.
Kugwiritsa ntchito mtundu kuti muwonjezere tanthauzo ku batani kumangopereka chiwonetsero chazithunzi, chomwe sichidzaperekedwa kwa ogwiritsa ntchito matekinoloje othandizira - monga owerenga pazenera. Onetsetsani kuti chidziwitso chotchulidwa ndi mtunduwo ndi chodziwikiratu kuchokera pazomwe zili (zolemba zowonekera pa batani), kapena zikuphatikizidwa ndi njira zina, monga zolemba zina zobisika ndi .sr-only
kalasi.
Mukufuna mabatani akulu kapena ang'onoang'ono? Onjezani .btn-lg
, .btn-sm
, kapena .btn-xs
ma size owonjezera.
Pangani mabatani a mulingo wa block—omwe amatambasula kukula kwa kholo lonse— powonjezera .btn-block
.
Mabatani adzawoneka atapanikizidwa (ndi maziko akuda, malire akuda, ndi mthunzi wamkati) akamagwira ntchito. Kwa <button>
zinthu, izi zimachitika kudzera pa :active
. Kwa <a>
zinthu, zachitika ndi .active
. Komabe, mutha kugwiritsa ntchito .active
pa <button>
s (ndikuphatikizanso mawonekedwe aria-pressed="true"
) ngati mungafunike kubwereza zomwe zikuchitika mwadongosolo.
Palibe chifukwa chowonjezera :active
chifukwa ndi gulu lachinyengo, koma ngati mukufuna kukakamiza mawonekedwe omwewo, pitirirani ndikuwonjezera .active
.
Onjezani .active
kalasi ku <a>
mabatani.
Pangani mabatani kuti awoneke ngati osadina powatsitsimutsanso ndi opacity
.
Onjezani mawonekedwe disabled
ku <button>
mabatani.
Mukawonjeza disabled
mawonekedwe a <button>
, Internet Explorer 9 ndi pansipa ipangitsa mawu kukhala imvi ndi chithunzi choyipa chomwe sitingathe kukonza.
Onjezani .disabled
kalasi ku <a>
mabatani.
Timagwiritsa ntchito .disabled
ngati gulu lothandizira pano, lofanana ndi gulu wamba .active
, kotero palibe mawu oyamba omwe amafunikira.
Kalasi iyi imagwiritsa ntchito pointer-events: none
kuyesa kuletsa magwiridwe antchito a ulalo wa <a>
s, koma katundu wa CSS sanakhazikitsidwebe ndipo sakuthandizidwa mokwanira mu Opera 18 ndi pansipa, kapena mu Internet Explorer 11. Kuphatikiza apo, ngakhale msakatuli omwe amathandizira pointer-events: none
, kiyibodi kuyenda sikunakhudzidwe, kutanthauza kuti ogwiritsa ntchito kiyibodi omwe amawona komanso ogwiritsa ntchito matekinoloje othandizira azitha kuyatsa maulalowa. Chifukwa chake kuti mukhale otetezeka, gwiritsani ntchito JavaScript kuti mulepheretse maulalo oterowo.
Zithunzi zomwe zili mu Bootstrap 3 zitha kupangidwa kukhala zomvera powonjezera .img-responsive
kalasi. Izi zimagwiranso ntchito max-width: 100%;
, height: auto;
komanso display: block;
pa chithunzicho kuti chikhale bwino ku chinthu cha makolo.
Kuti muike pakati zithunzi zomwe zimagwiritsa ntchito .img-responsive
kalasi, gwiritsani ntchito .center-block
m'malo mwa .text-center
. Onani gawo la makalasi othandizira kuti mumve zambiri za .center-block
kagwiritsidwe ntchito.
Mu Internet Explorer 8-10, zithunzi za SVG zomwe .img-responsive
zili ndi kukula kwake ndizosafanana. Kuti mukonze izi, onjezerani width: 100% \9;
ngati kuli kofunikira. Bootstrap siigwiritsa ntchito izi zokha chifukwa imayambitsa zovuta pamitundu ina yazithunzi.
Onjezani makalasi kuzinthu kuti <img>
musinthe mosavuta zithunzi zamapulojekiti aliwonse.
Kumbukirani kuti Internet Explorer 8 ilibe chithandizo pamakona ozungulira.
Fotokozerani tanthauzo kudzera mumitundu ndi makalasi ochepa otsimikiza. Izi zitha kugwiritsidwanso ntchito pa maulalo ndipo zidzadetsedwa pa hover monga masitayelo athu osakhazikika.
Fusce dapibus, tellus ac cursus commodo, tortor mauris nibh.
Nullam id dolor id nibh ultricies vehicula ut id elit.
Ndife mollis, si commodo luctus, si erat porttitor ligula.
Maecenas sed diam eget risus varius blandit sit amet non magna.
Etiam porta sem malesuada magna mollis euismod.
Donec ullamcorper nulla non metus auctor fringilla.
Nthawi zina makalasi otsindika sangathe kugwiritsidwa ntchito chifukwa cha kusankhidwa kwa wina. Nthawi zambiri, njira yokwanira ndiyo kukulunga mawu anu <span>
ndi kalasi.
Kugwiritsa ntchito utoto kuti muwonjezere tanthauzo kumangopereka chithunzithunzi, chomwe sichidzaperekedwa kwa ogwiritsa ntchito matekinoloje othandizira - monga owerenga pazenera. Onetsetsani kuti chidziwitso cha mtunduwo ndi chodziwikiratu kuchokera pazomwe zili (mitundu yamtunduwu imangogwiritsidwa ntchito kulimbikitsa tanthauzo lomwe lilipo kale m'mawu / kuyika), kapena ikuphatikizidwa ndi njira zina, monga zolemba zina zobisika ndi .sr-only
kalasi. .
Mofanana ndi makalasi amtundu wa zolemba, ikani mosavuta maziko a chinthu ku kalasi iliyonse. Zida za nangula zidzadetsedwa pa hover, monga makalasi amawu.
Nullam id dolor id nibh ultricies vehicula ut id elit.
Ndife mollis, si commodo luctus, si erat porttitor ligula.
Maecenas sed diam eget risus varius blandit sit amet non magna.
Etiam porta sem malesuada magna mollis euismod.
Donec ullamcorper nulla non metus auctor fringilla.
Nthawi zina makalasi akumbuyo sangathe kugwiritsidwa ntchito chifukwa cha kusankhidwa kwamtundu wina. Nthawi zina, njira yokwanira ndiyo kukulunga zomwe zili muzinthu zanu <div>
ndi kalasi.
Monga momwe zilili ndi mitundu ya zinthu , onetsetsani kuti tanthauzo lililonse loperekedwa kudzera mumtundu uliwonse likuperekedwanso m'njira yomwe siili yowonetsera.
Gwiritsani ntchito chizindikiro chapafupi chotseka pochotsa zinthu monga ma modals ndi zidziwitso.
Gwiritsani ntchito ma carets kuti muwonetse magwiridwe antchito ndi njira. Zindikirani kuti chisamaliro chokhazikika chidzasinthiratu m'ma menyu otsitsa .
Sungani chinthu kumanzere kapena kumanja ndi kalasi. !important
imaphatikizidwa kuti tipewe zovuta zenizeni. Makalasi amathanso kugwiritsidwa ntchito ngati zosakaniza.
Khazikitsani chinthu kukhala display: block
ndi pakati kudzera pa margin
. Imapezeka ngati mixin ndi kalasi.
Kumveka bwino float
s powonjezera .clearfix
ku chinthu cha makolo . Amagwiritsa ntchito micro clearfix monga kutchuka kwa Nicolas Gallagher. Itha kugwiritsidwanso ntchito ngati mixin.
Limbikitsani chinthu kuti chiwonetsedwe kapena kubisika ( kuphatikiza zowerengera zowonera ) pogwiritsa ntchito .show
ndi .hidden
makalasi. Maphunzirowa amagwiritsidwa ntchito !important
kupewa mikangano yeniyeni, monga momwe zimayandama mwachangu . Amangopezeka pakusintha ma block level. Atha kugwiritsidwanso ntchito ngati zosakaniza.
.hide
likupezeka, koma sizimakhudza nthawi zonse owerenga zenera ndipo limachotsedwa ngati v3.0.1 . Gwiritsani ntchito .hidden
kapena .sr-only
m'malo mwake.
Kuphatikiza apo, .invisible
zitha kugwiritsidwa ntchito kusintha mawonekedwe a chinthu, kutanthauza kuti display
sichinasinthidwe ndipo chinthucho chikhoza kukhudzabe kuyenda kwa chikalatacho.
Bisani chinthu pazida zonse kupatula zowerenga zenera zomwe zili ndi .sr-only
. Phatikizani .sr-only
ndi .sr-only-focusable
kuti muwonetsenso chinthucho chikayang'ana kwambiri (mwachitsanzo ndi wogwiritsa ntchito kiyibodi yekha). Zofunikira pakutsata njira zabwino zopezeka . Itha kugwiritsidwanso ntchito ngati zosakaniza.
Gwiritsani ntchito .text-hide
kalasi kapena mixin kuti musinthe zomwe zili patsamba ndi chithunzi chakumbuyo.
Kuti chitukuko chikhale chosavuta kugwiritsa ntchito mafoni, gwiritsani ntchito makalasi othandizirawa kuti muwonetse ndi kubisa zomwe zili ndi chipangizocho kudzera pafunso lazama TV. Kuphatikizidwanso ndi makalasi othandizira osinthira zinthu zikasindikizidwa.
Yesani kugwiritsa ntchito izi pang'onopang'ono ndikupewa kupanga mitundu yosiyana ya tsamba lomwelo. M'malo mwake, zigwiritseni ntchito kuti zigwirizane ndi mawonekedwe a chipangizo chilichonse.
Gwiritsani ntchito makalasi amodzi kapena ophatikizira omwe alipo kuti musinthe zomwe zili pagawo lowonera.
Zida zazing'ono zowonjezeraMafoni (<768px) | Zida zazing'onoMapiritsi (≥768px) | Zida zapakatikatiMakompyuta (≥992px) | Zida zazikuluMakompyuta (≥1200px) | |
---|---|---|---|---|
.visible-xs-* |
Zowoneka | Zobisika | Zobisika | Zobisika |
.visible-sm-* |
Zobisika | Zowoneka | Zobisika | Zobisika |
.visible-md-* |
Zobisika | Zobisika | Zowoneka | Zobisika |
.visible-lg-* |
Zobisika | Zobisika | Zobisika | Zowoneka |
.hidden-xs |
Zobisika | Zowoneka | Zowoneka | Zowoneka |
.hidden-sm |
Zowoneka | Zobisika | Zowoneka | Zowoneka |
.hidden-md |
Zowoneka | Zowoneka | Zobisika | Zowoneka |
.hidden-lg |
Zowoneka | Zowoneka | Zowoneka | Zobisika |
Pofika pa v3.2.0, .visible-*-*
makalasi a chigawo chilichonse amabwera m'mitundu itatu, imodzi pamtengo uliwonse wa CSS display
womwe walembedwa pansipa.
Gulu la makalasi | CSSdisplay |
---|---|
.visible-*-block |
display: block; |
.visible-*-inline |
display: inline; |
.visible-*-inline-block |
display: inline-block; |
Chifukwa chake, pazowonjezera zazing'ono ( xs
) zowonera mwachitsanzo, .visible-*-*
makalasi omwe alipo ndi awa: .visible-xs-block
, .visible-xs-inline
, ndi .visible-xs-inline-block
.
Makalasi .visible-xs
, .visible-sm
, .visible-md
, .visible-lg
komanso alipo, koma achotsedwa pa v3.2.0 . Amakhala ofanana ndi .visible-*-block
, kupatulapo ndi zina zapadera <table>
zosinthira zinthu zokhudzana ndi kusintha.
Mofanana ndi makalasi omvera okhazikika, gwiritsani ntchito izi posintha zinthu kuti zisindikizidwe.
Maphunziro | Msakatuli | Sindikizani |
---|---|---|
.visible-print-block .visible-print-inline .visible-print-inline-block |
Zobisika | Zowoneka |
.hidden-print |
Zowoneka | Zobisika |
Kalasiyi .visible-print
iliponso koma idachotsedwa ngati v3.2.0 . Ndi pafupifupi ofanana ndi .visible-print-block
, kupatulapo ndi zina zapadera za <table>
-zinthu zokhudzana.
Sinthani kukula kwa msakatuli wanu kapena tsegulani pazida zosiyanasiyana kuti muyese makalasi ogwiritsa ntchito.
Zizindikiro zobiriwira zikuwonetsa kuti chinthucho chikuwoneka patsamba lanu lapano.
Apa, zolembera zobiriwira zikuwonetsanso kuti chinthucho chabisika pamawonedwe anu apano.
Bootstrap's CSS imamangidwa pa Zochepa, preprocessor yokhala ndi zina zowonjezera monga zosinthika, zosakaniza, ndi ntchito zopanga CSS. Omwe akuyang'ana kugwiritsa ntchito gwero Mafayilo Ochepa m'malo mwa mafayilo athu a CSS omwe adapangidwa amatha kugwiritsa ntchito mitundu ingapo ndi zosakaniza zomwe timagwiritsa ntchito pamapangidwe onse.
Zosintha za gridi ndi zosakaniza zimaphimbidwa mkati mwa gawo la Grid system .
Bootstrap ingagwiritsidwe ntchito m'njira zosachepera ziwiri: ndi CSS yopangidwa kapena ndi gwero Mafayilo Ochepa. Kuti muphatikize mafayilo Ochepa, onani gawo la Poyambira momwe mungakhazikitsire malo anu otukuka kuti muyendetse malamulo ofunikira.
Zida zophatikizira gulu lachitatu zitha kugwira ntchito ndi Bootstrap, koma sizimathandizidwa ndi gulu lathu lalikulu.
Zosintha zimagwiritsidwa ntchito mu polojekiti yonse ngati njira yokhazikitsira pakati ndikugawana zinthu zomwe zimagwiritsidwa ntchito nthawi zambiri monga mitundu, masitayilo, kapena mafonti. Kuti mumve zambiri, chonde onani Customizer .
Gwiritsani ntchito mitundu iwiri yosavuta: imvi ndi semantic. Mitundu ya grayscale imapereka mwayi wofikira mwachangu ku mithunzi yakuda yomwe imagwiritsidwa ntchito nthawi zambiri pomwe semantic imaphatikizapo mitundu yosiyanasiyana yomwe imaperekedwa kuzinthu zofunikira.
Gwiritsani ntchito mtundu uliwonse wamitundu iyi momwe ilili kapena muwagawirenso kumitundu yofunikira kwambiri ya polojekiti yanu.
Zosintha zingapo kuti musinthe mwachangu zinthu zazikulu zamafupa atsamba lanu.
Sinthani maulalo anu mosavuta ndi mtundu woyenera wokhala ndi mtengo umodzi wokha.
Dziwani kuti @link-hover-color
amagwiritsa ntchito, chida china chodabwitsa kuchokera ku Zochepa, kuti apange mtundu woyenera wa hover. Mutha kugwiritsa ntchito darken
, lighten
, saturate
, ndi desaturate
.
Khazikitsani zilembo zanu mosavuta, kukula kwa mawu, kutsogola, ndi zina zambiri pogwiritsa ntchito zosintha mwachangu. Bootstrap imagwiritsa ntchito izi komanso kupereka zosakaniza zosavuta za typographic.
Mitundu iwiri yofulumira yosinthira malo ndi dzina lafayilo la zithunzi zanu.
Zida mu Bootstrap zimagwiritsa ntchito zosintha zina zokhazikika pokhazikitsa zomwe zimafanana. Nazi zomwe zimagwiritsidwa ntchito kwambiri.
Zosakaniza za ogulitsa ndi zosakaniza zothandizira kuthandizira asakatuli angapo pophatikiza ma prefixes onse oyenera mu CSS yanu yopangidwa.
Bwezerani bokosi lachigawo chanu ndi chosakaniza chimodzi. Kuti mumve zambiri, onani nkhaniyi yothandiza kuchokera ku Mozilla .
Kusakaniza kumachotsedwa ngati v3.2.0, ndikuyambitsa Autoprefixer. Kuti musunge kuyanjana kwa mmbuyo, Bootstrap ipitiliza kugwiritsa ntchito mixin mkati mpaka Bootstrap v4.
Masiku ano asakatuli onse amakono amathandizira border-radius
katundu wopanda prefixed. Mwakutero, palibe .border-radius()
mixin, koma Bootstrap imaphatikizapo njira zazifupi zozungulira mwachangu ngodya ziwiri kumbali inayake ya chinthu.
Ngati omvera anu akugwiritsa ntchito asakatuli aposachedwa komanso zida zazikulu, onetsetsani kuti mwangogwiritsa ntchito box-shadow
malowo okha. Ngati mukufuna chithandizo cha zipangizo zakale za Android (pre-v4) ndi iOS (iOS 5 isanayambe), gwiritsani ntchito mixin yomwe yachotsedwa kuti mutenge -webkit
chiyambi chofunikira.
Kusakaniza kumachotsedwa ngati v3.1.0, popeza Bootstrap sichigwirizana ndi nsanja zakale zomwe sizigwirizana ndi katundu wamba. Kuti musunge kuyanjana kwa mmbuyo, Bootstrap ipitiliza kugwiritsa ntchito mixin mkati mpaka Bootstrap v4.
Onetsetsani kuti mumagwiritsa ntchito rgba()
mitundu mumithunzi yamabokosi anu kuti igwirizane momasuka momwe mungathere ndi maziko.
Zosakaniza zingapo kuti muzitha kusinthasintha. Khazikitsani zosintha zonse ndi imodzi, kapena tchulani kuchedwa ndi nthawi yomwe ikufunika.
Zosakaniza zimachotsedwa ngati v3.2.0 , ndikuyambitsa Autoprefixer. Kuti musunge kuyanjana chakumbuyo, Bootstrap ipitiliza kugwiritsa ntchito zosakaniza mkati mpaka Bootstrap v4.
Sinthani, sikeni, masulirani (sunthani), kapena potoza chinthu chilichonse.
Zosakaniza zimachotsedwa ngati v3.2.0 , ndikuyambitsa Autoprefixer. Kuti musunge kuyanjana chakumbuyo, Bootstrap ipitiliza kugwiritsa ntchito zosakaniza mkati mpaka Bootstrap v4.
Kusakaniza kumodzi kogwiritsa ntchito makanema ojambula a CSS3 mu chilengezo chimodzi ndi zosakaniza zina zamtundu uliwonse.
Zosakaniza zimachotsedwa ngati v3.2.0 , ndikuyambitsa Autoprefixer. Kuti musunge kuyanjana chakumbuyo, Bootstrap ipitiliza kugwiritsa ntchito zosakaniza mkati mpaka Bootstrap v4.
Khazikitsani kuwala kwa asakatuli onse ndikupereka filter
kubweza kwa IE8.
Perekani nkhani zowongolera mawonekedwe mkati mwa gawo lililonse.
Pangani mizati kudzera pa CSS mkati mwa chinthu chimodzi.
Sinthani mosavuta mitundu iwiri iliyonse kukhala gradient yakumbuyo. Pitani patsogolo kwambiri ndikukhazikitsa kolowera, gwiritsani ntchito mitundu itatu, kapena gwiritsani ntchito ma radial gradient. Ndi kuphatikiza kumodzi mumapeza ma syntaxes onse omwe mungafune.
Mutha kutchulanso ngodya yamitundu iwiri, mizere yozungulira:
Ngati mukufuna mizere yometa, ndizosavuta, nanunso. Ingotchulani mtundu umodzi ndipo tidzakuta mizere yoyera yowoneka bwino.
Pamwamba pa ante ndikugwiritsa ntchito mitundu itatu m'malo mwake. Khazikitsani mtundu woyamba, wachiwiri, mtundu wachiwiri woyimitsa (mtengo wamtengo wapatali ngati 25%), ndi mtundu wachitatu wokhala ndi zosakaniza izi:
Mungodziwiratu! Ngati mungafunike kuchotsa gradient, onetsetsani kuti mwachotsa chilichonse cha IE chomwe filter
mungawonjezere. Mutha kuchita izi pogwiritsa ntchito .reset-filter()
mixin pamodzi background-image: none;
.
Zosakaniza zothandiza ndi zosakaniza zomwe zimaphatikiza zinthu zina za CSS zosagwirizana kuti zikwaniritse cholinga kapena ntchito inayake.
Iwalani kuwonjezera class="clearfix"
pa chinthu chilichonse ndipo m'malo mwake onjezerani .clearfix()
mixin ngati kuli koyenera. Amagwiritsa ntchito micro clearfix kuchokera kwa Nicolas Gallagher .
Ikani mwachangu chinthu chilichonse mkati mwa kholo lake. Imafunika width
kapena max-width
kukhazikitsidwa.
Tchulani miyeso ya chinthu mosavuta.
Konzani zosankha zosinthira mosavuta zamtundu uliwonse, kapena china chilichonse. Zosintha pamachitidwe a msakatuli wabwinobwino ( both
).
Chepetsani mawu mosavuta ndi ellipsis ndi chosakaniza chimodzi. Imafunika chinthu kukhala block
kapena inline-block
mlingo.
Tchulani njira ziwiri zazithunzi ndi @1x kukula kwazithunzi, ndipo Bootstrap ipereka @2x media query. Ngati muli ndi zithunzi zambiri zoti mugwiritse ntchito, ganizirani kulemba chithunzi chanu cha retina CSS pamanja pafunso limodzi lazakanema.
Ngakhale Bootstrap imamangidwa Pang'ono, ilinso ndi doko lovomerezeka la Sass . Timachisunga munkhokwe ya GitHub ndikusintha zosintha ndi script yosinthira.
Popeza doko la Sass lili ndi repo lapadera ndipo limatumikira anthu osiyana pang'ono, zomwe zili mu polojekitiyi zimasiyana kwambiri ndi polojekiti yayikulu ya Bootstrap. Izi zimatsimikizira kuti doko la Sass likugwirizana ndi machitidwe ambiri a Sass momwe angathere.
Njira | Kufotokozera |
---|---|
lib/ |
Nambala yamtengo wapatali ya Ruby (Masinthidwe a Sass, Ma Rail ndi Compass kuphatikiza) |
tasks/ |
Zolemba zosinthira (kutembenukira kumtunda Pang'ono kupita ku Sass) |
test/ |
Mayeso ophatikiza |
templates/ |
Chiwonetsero cha phukusi la Compass |
vendor/assets/ |
Sass, JavaScript, ndi mafayilo amtundu |
Rakefile |
Ntchito zamkati, monga rake ndikusintha |
Pitani ku Sass port's GitHub repository kuti muwone mafayilowa akugwira ntchito.
Kuti mumve zambiri zamomwe mungayikitsire ndikugwiritsa ntchito Bootstrap ya Sass, onani tsamba la GitHub lowerenga . Ndilo gwero laposachedwa kwambiri ndipo limaphatikizapo zambiri zogwiritsidwa ntchito ndi Rails, Compass, ndi mapulojekiti wamba a Sass.