CSS a ɛwɔ hɔ
Wiase nyinaa CSS nhyehyɛe, HTML nneɛma atitiriw a wɔayɛ no sɛnea wɔpɛ na wɔde adesua ahorow a wotumi trɛw mu ayɛ no yiye, ne grid nhyehyɛe a ɛkɔ anim.
Wiase nyinaa CSS nhyehyɛe, HTML nneɛma atitiriw a wɔayɛ no sɛnea wɔpɛ na wɔde adesua ahorow a wotumi trɛw mu ayɛ no yiye, ne grid nhyehyɛe a ɛkɔ anim.
Nya lowdown wɔ Bootstrap no infrastructure no afã atitiriw no ho, a yɛn kwan a yɛfa so yɛ wɛb nkɔso a eye, ɛyɛ ntɛm, ɛyɛ den ka ho.
Bootstrap de HTML nneɛma bi ne CSS agyapade a ɛhwehwɛ sɛ wɔde HTML5 doctype di dwuma di dwuma. Fa ka ho wɔ wo nnwuma nyinaa mfiase.
Bootstrap 2 no, yɛde mobile adamfofa kwan a wobɛpaw kaa ho maa afã atitiriw a ɛwɔ nhyehyɛe no mu. Bootstrap 3 no, yɛasan akyerɛw adwuma no sɛnea ɛbɛyɛ a ɛbɛyɛ mobile adamfofa fi mfiase. Sɛ́ anka wode mobile styles a wopɛ bɛka ho no, wɔtow no mu pɛɛ wɔ core no mu. Nokwarem no, Bootstrap yɛ mobile kan . Wobetumi ahu mobile first styles wɔ nhomakorabea no nyinaa mu sen sɛ wobehu wɔ fael ahorow mu.
Sɛnea ɛbɛyɛ a wobɛhwɛ ahu sɛ wobɛkyerɛ ase yiye na woaka zoom no, fa viewport meta tag no ka wo <head>
.
Wubetumi asiw zooming tumi ano wɔ mobile mfiri ahorow so denam nea wode bɛka user-scalable=no
viewport meta tag no ho no so. Wei ma zooming no ntumi nyɛ adwuma, a ɛkyerɛ sɛ wɔn a wɔde di dwuma no tumi twetwe wɔn ho nkutoo, na ɛma wo sait no te nka kakra sɛ ɛyɛ native application. Sɛ yɛka ne nyinaa bom a, yɛnkamfo eyi nkyerɛ wɔ wɛbsaet biara so, enti yɛ ahwɛyiye!
Bootstrap hyehyɛ wiase nyinaa nkyerɛkyerɛmu titiriw, typography, ne link styles. Ne titiriw no, yɛn:
background-color: #fff;
no sobody
@font-family-base
, @font-size-base
, ne @line-height-base
su ahorow no di dwuma sɛ yɛn nkyerɛwee nnyinaso@link-color
na fa link underlines nkutoo di dwuma wɔ so:hover
Wobetumi ahu saa ntade ahorow yi wɔ scaffolding.less
.
Sɛ wopɛ sɛ wunya cross-browser nkyerɛase a ɛkɔ anim a, yɛde Normalize.css , adwuma bi a Nicolas Gallagher ne Jonathan Neal yɛe no di dwuma.
Bootstrap hwehwɛ element a ɛwɔ mu a ɛbɛkyekyere site no mu nsɛm na yɛde yɛn grid nhyehyɛe no ahyɛ mu. Wubetumi apaw nsukorade abien a wode bedi dwuma wɔ wo nnwuma mu no mu biako. Hyɛ no nsow sɛ, esiane padding
ne nea ɛboro saa nti, container abien no mu biara nyɛ nestable.
Fa di dwuma .container
ma mmuae a ɛyɛ fixed width container.
Fa di dwuma .container-fluid
ma ade a ne tɛtrɛtɛ nyinaa, a ɛtrɛw wo viewport no ntrɛwmu nyinaa mu.
Bootstrap no ka ho bi ne mmuae, mobile first fluid grid nhyehyɛe a ɛfata sɛ ɛyɛ 12 columns bere a device anaa viewport kɛse kɔ soro no. Ɛka adesua ahorow a wɔadi kan akyerɛkyerɛ mu ama nhyehyɛe a ɛnyɛ den a wobetumi apaw, ne mixins a ahoɔden wom a wɔde bɛma nkyerɛase nhyehyɛe pii aba .
Wɔde grid nhyehyɛe ahorow di dwuma de yɛ krataafa nhyehyɛe denam row ne column ahorow a ɛtoatoa so a wode wo nsɛm no sie so. Sɛnea Bootstrap grid nhyehyɛe no yɛ adwuma ni:
.container
(fixed-width) anaa .container-fluid
(full-width) mu na ama wɔatumi ayɛ pɛpɛɛpɛ na wɔde ahyɛ mu..row
na .col-xs-4
ɛwɔ hɔ ma grid nhyehyɛe ahorow a wɔyɛ no ntɛmntɛm. Wobetumi nso de mixins kakraa bi adi dwuma ama nkyerɛase nhyehyɛe pii.padding
. Saa padding no offset wɔ rows ma column a edi kan ne nea etwa to via negative margin wɔ .row
s..col-xs-4
..col-md-*
adesuakuw biara di dwuma wɔ element bi so a, ɛnyɛ sɛ ɛbɛka ne styling wɔ mfiri a ɛwɔ mfinimfini nko na mmom mfiri akɛse nso so sɛ .col-lg-*
adesuakuw bi nni hɔ a.Hwɛ nhwɛso ahorow a wode bedi dwuma wɔ nnyinasosɛm ahorow yi mu wɔ wo mmara no mu.
Yɛde media nsɛmmisa a edidi so yi di dwuma wɔ yɛn Less fael ahorow no mu de yɛ breakpoints atitiriw no wɔ yɛn grid nhyehyɛe no mu.
Ɛtɔ mmere bi a yɛtrɛw saa media nsɛmmisa yi mu de ka ho max-width
de to CSS ano hye wɔ mfiri ahorow a ɛyɛ teateaa bi so.
Hwɛ sɛnea Bootstrap grid nhyehyɛe no afã horow yɛ adwuma wɔ mfiri ahorow pii a ɛwɔ pon a ɛyɛ mmerɛw so.
Mfiri nketewa a ɛboro so Phones (<768px) . | Mfiri nketewa Tablets (≥768px) . | Mfiri a ɛwɔ mfinimfini Desktops (≥992px) . | Mfiri akɛse Desktops (≥1200px) . | |
---|---|---|---|---|
Grid suban a ɛwɔ hɔ | Horizontal bere nyinaa | Collapsed to start, horizontal atifi breakpoints | ||
Nneɛma a wɔde gu mu no trɛw | Obiara nni hɔ (auto) . | 750px na ɛyɛ | 970px na ɛyɛ | 1170px na ɛyɛ |
Adesuakuw no anim asɛm | .col-xs- |
.col-sm- |
.col-md- |
.col-lg- |
# a ɛwɔ nkyerɛwde ahorow mu | 12. 12 | |||
Kɔla no trɛw | Auto | ~62px na ɛwɔ hɔ | ~81px na ɛwɔ hɔ | ~97px na ɛwɔ hɔ |
Gutter no trɛw | 30px (15px wɔ ɔfa biara a ɛwɔ kɔla bi so) . | |||
Nea ɛyɛ nestable | Aane | |||
Nneɛma a wɔde siw nneɛma ano | Aane | |||
Kɔla a wɔkra no | Aane |
Sɛ wode .col-md-*
grid adesua ahorow biako di dwuma a, wubetumi ayɛ grid nhyehyɛe titiriw a efi ase a wɔaboaboa ano wɔ mobile mfiri ne tablɛt mfiri ahorow so (a ɛyɛ ketewa kosi ketewaa a ɛboro so no) ansa na abɛyɛ horizontal wɔ desktop (mfinimfini) mfiri ahorow so. Fa grid columns gu biribiara .row
mu .
Dane grid nhyehyɛe biara a ne tɛtrɛtɛ a wɔahyɛ da ayɛ no ma ɛnyɛ nhyehyɛe a ne tɛtrɛtɛ nyinaa denam wo akyi fã a wobɛsesa no .container
ayɛ no .container-fluid
.
Wompɛ sɛ wo columns no bɛboaboa ano kɛkɛ wɔ mfiri nketewa mu? Fa mfiri nketewa ne mfinimfini a ɛboro so no grid adesua ahorow no di dwuma denam .col-xs-*
.col-md-*
wo nkyerɛwde ahorow a wode bɛka ho no so. Hwɛ nhwɛso a ɛwɔ ase ha no na woanya sɛnea ne nyinaa yɛ adwuma no ho adwene pa.
Fa nhwɛso a atwam no si so denam nhyehyɛe ahorow a ɛyɛ nnam na tumi wom kɛse mpo a wode tablet .col-sm-*
adesua ahorow bɛbɔ so.
Sɛ wɔde nkyerɛwde bɛboro 12 gu ɔfa biako mu a, nkorabata foforo kuw biara, sɛ ade biako, bɛbɔ nkyerɛwde foforo so.
Na anan tiers of grids a ɛwɔ hɔ no, ɛyɛ ampa sɛ wubetu mmirika akɔ nsɛm a, wɔ breakpoints bi mu no, wo columns no ntumi ntew yiye koraa sɛnea biako tenten sen biako no. Sɛ wopɛ sɛ wusiesie saa a, fa a .clearfix
ne yɛn responsive utility class ahorow no a wɔaka abom di dwuma .
Wɔ column clearing wɔ responsive breakpoints akyi no, ebia ɛho behia sɛ wosan de offsets, pushes, anaa pullls . Hwɛ eyi wɔ adeyɛ mu wɔ grid nhwɛso no mu .
Fa nkyerɛwde ahorow no kɔ nifa denam .col-md-offset-*
adesua ahorow so. Saa adesua ahorow yi ma kɔla bi benkum so no yɛ kɛse denam *
nkyerɛwde ahorow so. Sɛ nhwɛso no, .col-md-offset-4
ɛkɔfa .col-md-4
adum anan so.
Wubetumi nso de .col-*-offset-0
adesua ahorow abɔ offset ahorow a efi grid tiers a ɛwɔ fam no so.
Sɛ wopɛ sɛ wode default grid no hyɛ wo nsɛm no mu a, fa kɔla foforo .row
ne .col-sm-*
nkyerɛwde ahorow ka ho wɔ .col-sm-*
kɔla bi a ɛwɔ hɔ dedaw no mu. Ɛsɛ sɛ nested rows no de columns ahorow a ɛka bom yɛ 12 anaa nea ennu saa ka ho (ɛnhia sɛ wode columns 12 a ɛwɔ hɔ no nyinaa bedi dwuma).
Ɛnyɛ den sɛ wobɛsesa yɛn grid columns a wɔasisi no nhyehyɛe a ɛwɔ .col-md-push-*
ne .col-md-pull-*
modifier classes no.
Wɔ grid adesua ahorow a wɔadi kan ayɛ ama nhyehyɛe ahorow a ɛyɛ ntɛm akyi no, Bootstrap de Less variables ne mixins ka ho ma w’ankasa nhyehyɛe ahorow a ɛnyɛ den, a ɛkyerɛ biribi ntɛmntɛm.
Variables kyerɛ column dodow, gutter trɛw, ne media asɛmmisa beae a wobefi ase floating columns. Yɛde eyinom di dwuma de yɛ grid adesua ahorow a wɔahyɛ ato hɔ a wɔakyerɛw ho asɛm wɔ atifi hɔ no, ne afei nso mixins a wɔahyɛ da ayɛ a wɔakyerɛw wɔ ase ha no.
Wɔde mixins di dwuma de ka grid variables no ho de yɛ semantic CSS ma grid columns ankorankoro.
Wubetumi asesa variables no akɔ w’ankasa custom values no mu, anaasɛ wode mixins no adi dwuma kɛkɛ ne wɔn default values no. Nhwɛsoɔ a ɛfa default nhyehyeɛ no a wode bɛyɛ nhyehyɛɛ a ɛwɔ kɔla mmienu a ɛwɔ nsonsonoeɛ wɔ ntam no nie.
HTML asɛmti nyinaa, <h1>
kosi <h6>
, wɔ hɔ. .h1
through .h6
classes nso wɔ hɔ, ma bere a wopɛ sɛ wo ne font styling a ɛwɔ asɛmti bi mu no hyia nanso woda so ara pɛ sɛ wo nsɛm no da adi wɔ inline mu.
h1. Bootstrap asɛmti no |
Semibold a ɛyɛ 36px |
h2. Bootstrap asɛmti no |
Semibold a ɛyɛ 30px |
h3. Bootstrap asɛmti no |
Semibold a ɛyɛ 24px |
h4. Bootstrap asɛmti no |
Semibold a ɛyɛ 18px |
h5. Bootstrap asɛmti no |
Semibold a ɛyɛ 14px |
h6. Bootstrap asɛmti no |
Semibold a ɛyɛ 12px |
Yɛ nsɛm a ɛyɛ hare, a ɛto so abien wɔ asɛmti biara mu a ɛwɔ generic <small>
tag anaa .small
adesuakuw no.
h1. Bootstrap asɛmti Nsɛm a ɛto so abien |
h2. Bootstrap asɛmti Nsɛm a ɛto so abien |
h3. Bootstrap asɛmti Nsɛm a ɛto so abien |
h4. Bootstrap asɛmti Nsɛm a ɛto so abien |
h5. Bootstrap asɛmti Nsɛm a ɛto so abien |
h6. Bootstrap asɛmti Nsɛm a ɛto so abien |
Bootstrap no wiase nyinaa default font-size
yɛ 14px , a ne line-height
yɛ 1.428 . Wɔde eyi di dwuma wɔ <body>
nkyekyem ahorow no ne ne nyinaa ho. Bio nso, <p>
(nkyekyɛm ahorow) nya ase margin a ɛyɛ wɔn line-height a wɔabu akontaa no fã (10px default).
Nullam quis risus eget urna mollis a ɛyɛ fɛ a ɛyɛ fɛ a ɛyɛ fɛ. Cum sociis natoque penatibus ne magnis awo montes, nascetur fɛwdi mus. Nullam id dolor id nibh ultricies kar a wɔde di dwuma.
Cum sociis natoque penatibus ne magnis awo montes, nascetur fɛwdi mus. Donec ullamcorper nulla a ɛnyɛ nea ɛyɛ adetɔnfo fringilla. Duis mollis, est a ɛnyɛ commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Donec ullamcorper nulla a ɛnyɛ nea ɛyɛ adetɔnfo fringilla.
Maecenas sed diam eget risus varius blandit tena ase a ɛnyɛ magna. Donec id elit a ɛnyɛ mi porta gravida wɔ eget metus. Duis mollis, est a ɛnyɛ commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit.
Ma nkyekyem bi da nsow denam .lead
.
Vivamus sagittis lacus vel augue laoreet a ɛyɛ mmerɛw sɛ wobɛtɔ no. Duis mollis, est a ɛnyɛ ade a wɔde yɛ nneɛma.
Typographic scale no gyina Less variables abien so wɔ variables mu.less : @font-size-base
ne @line-height-base
. Nea edi kan ne base font-size a wɔde di dwuma wɔ ne nyinaa mu na nea ɛto so abien ne base line-height. Yɛde saa variables no ne akontabuo a ɛnyɛ den bi di dwuma de yɛ margins, paddings, ne line-heights a ɛwɔ yɛn type no nyinaa ne nea ɛkeka ho. Yɛ wɔn sɛnea wopɛ na Bootstrap no dannan wɔn ho.
Sɛ wopɛ sɛ wotwe adwene si nkyerɛwee bi a ɛrekɔ so esiane sɛ ɛfa ho wɔ nsɛm foforo mu nti a, fa <mark>
tag no di dwuma.
Wubetumi de agyiraehyɛde tag no adi dwuma deda no adiatwerɛ.
Sɛ wopɛ sɛ wokyerɛ nsɛm a wɔapopa no a, fa <del>
tag no di dwuma.
Wɔayɛ sɛ wɔbɛfa saa nsɛm a wɔahyehyɛ yi sɛ nsɛm a wɔapopa.
Sɛ wopɛ sɛ wokyerɛ nsɛm a wɔabɔ no mu a ɛnyɛ nea ɛfata bio a, fa <s>
tag no di dwuma.
Wɔayɛ sɛ wɔbɛfa saa nkyerɛwee yi sɛ ɛnyɛ nokware bio.
Sɛ wopɛ sɛ wokyerɛ nneɛma a wɔde aka krataa no ho a, fa <ins>
tag no di dwuma.
Wɔayɛ sɛ wɔbɛfa saa nsɛm a wɔahyehyɛ yi sɛ ade a wɔde aka krataa no ho.
Sɛ wopɛ sɛ wotwe adwene si nsɛm so a, fa <u>
tag no di dwuma.
Saa nsɛm yi bɛkyerɛ ase sɛnea wɔatwe adwene asi so no
Fa HTML no default emphasis tags a ɛwɔ styles a emu yɛ hare no di dwuma.
Sɛ wopɛ sɛ woyi nsɛm a ɛwɔ mu anaa nsɛm a wɔabɔ no so dua no so dua a, fa <small>
tag no si nsɛm no so wɔ ɔwofo no kɛse 85%. Heading elements nya wɔn ankasa de font-size
ma nested<small>
elements.
Wubetumi de inline element a .small
ɛwɔ biara ananmu adi dwuma ɔkwan foforo so <small>
.
Wɔayɛ sɛ wɔbɛfa saa nsɛm a wɔahyehyɛ yi sɛ nkyerɛwde a ɛyɛ fɛ.
Sɛ wode font-weight a emu yɛ duru si nsɛm a wɔakyerɛw no fã bi so dua.
Wɔakyerɛ nsɛm a edidi so yi ase sɛ nsɛm a ɛyɛ tuntum .
Sɛ́ wubesi nsɛm a wɔakyerɛw no fã bi a wɔde italics ahyɛ mu so dua no.
Wɔakyerɛ nsɛm a edidi so yi ase sɛ nsɛm a wɔakyerɛw no italic .
Te nka sɛ wowɔ ahofadi sɛ wode bedi dwuma <b>
na wode adi dwuma <i>
wɔ HTML5 mu. <b>
no kyerɛ sɛ ɛbɛtwe adwene asi nsɛmfua anaa nsɛmfua so a ɛrenkyerɛ hia foforo a ɛho hia bere a <i>
ɛyɛ nea ɛfa nne, mfiridwuma ho nsɛmfua, ne nea ɛkeka ho ho titiriw.
Ɛnyɛ den sɛ wobɛsan asiesie nsɛm no akɔ afã horow a ɛwɔ nsɛm a wɔde hyɛ adesua ahorow mu.
Nkyerɛwee a wɔahyɛ no agyirae wɔ benkum so.
Nsɛm a wɔahyehyɛ no mfinimfini.
Nsɛm a wɔahyehyɛ no pɛpɛɛpɛ.
Nkyerɛwee a ɛfata.
Nsɛm a wɔde kyekyere nsɛm biara nni hɔ.
Sesa nsɛm wɔ components mu a text capitalization adesua ahorow wom.
Nsɛm a wɔde nkyerɛwde nketewa ahyɛ mu.
Nsɛm a wɔakyerɛw no nkyerɛwde akɛse.
Nsɛm a wɔde nkyerɛwde akɛse akyerɛw.
Stylized implementation of HTML's <abbr>
element ma abbreviations ne acronyms de kyerɛ nkyerɛase a wɔatrɛw mu no wɔ hover so. Nsɛmfua a wɔatwa no tiaa a ɛwɔ title
su bi wɔ ase hye a ɛwɔ nsensanee a ɛyɛ hann ne mmoa cursor wɔ hover so, a ɛma nsɛm foforo a ɛfa hover so ne wɔn a wɔde mfiridwuma a ɛboa di dwuma no.
Asɛmfua su no a wɔatwa no tiaa ne attr .
Fa ka .initialism
asɛmfua tiawa bi ho ma font-size a ɛyɛ ketewaa bi.
HTML yɛ ade a eye sen biara fi bere a wɔatwitwa paanoo no.
Fa nana a ɔbɛn no anaa adwuma no nyinaa nkitahodi ho nsɛm kyerɛ. Kora formatting so denam nkyerɛwde nyinaa a wode bɛhyɛ awiei no so <br>
.
Sɛ wopɛ sɛ wofa nsɛm a wɔabɔ no mua a efi baabi foforo a ɛwɔ wo krataa no mu a.
Fa HTML<blockquote>
biara kyekyere ho sɛ asɛm a wɔafa aka no. Sɛ wopɛ nsɛm a wɔafa aka tẽẽ a, yɛkamfo kyerɛ sɛ .<p>
Lorem ipsum dolor tena amet, consectetur adipiscing a ɛyɛ fɛ a ɛyɛ fɛ. Nkyekyɛm a edi mũ posuere erat a ante.
Style ne emu nsɛm sesa ma nsakrae a ɛnyɛ den wɔ gyinapɛn bi so <blockquote>
.
Fa a <footer>
ma wohu baabi a wonya fi no ka ho. Fa fibea adwuma no din kyekyere <cite>
.
Lorem ipsum dolor tena amet, consectetur adipiscing a ɛyɛ fɛ a ɛyɛ fɛ. Nkyekyɛm a edi mũ posuere erat a ante.
Fa ka ho .blockquote-reverse
ma blockquote a ɛwɔ nsɛm a ɛwɔ nifa so.
Nneɛma a wɔahyehyɛ a nhyehyɛe no ho nhia pefee.
Nneɛma a wɔahyehyɛ a nhyehyɛe no ho hia pefee wom.
Yi default list-style
ne benkum margin wɔ list nneɛma (mmofra ntɛm ara nkutoo). Eyi fa mmofra a wɔakyerɛw wɔn din ntɛm ara nneɛma nkutoo ho , a ɛkyerɛ sɛ ɛho behia sɛ wode adesuakuw no ka ho ma nkyerɛwde biara a wɔde ahyɛ mu nso.
Fa list nneɛma nyinaa gu line biako so ne display: inline-block;
ne padding bi a ɛyɛ hann.
Nsɛmfua a wɔahyehyɛ a nkyerɛkyerɛmu ahorow a ɛbata ho.
Yɛ nsɛmfua ne nkyerɛkyerɛmu ahorow a <dl>
wɔahyehyɛ no nnidiso nnidiso wɔ nkyɛnkyɛn. Starts off stacked like default <dl>
s, nanso sɛ navbar no trɛw a, saa ara na yɛ eyinom.
Horizontal description lists bɛtwa nsɛmfua a ɛware dodo sɛ ɛbɛfata wɔ benkum so kɔla no mu ne text-overflow
. Wɔ viewports teateaa mu no, wɔbɛsesa akɔ default stacked layout no so.
Fa inline snippets a ɛwɔ code no mu no kyekyere <code>
.
<section>
ɛsɛ sɛ wɔkyekyere no sɛ inline.
Fa no <kbd>
kyerɛ input a wɔtaa fa keyboard so hyɛ mu.
Fa di dwuma <pre>
ma koodu nkyerɛwde ahorow pii. Hwɛ hu sɛ wubeguan afi angle brackets biara a ɛwɔ code no mu no mu na ama woatumi akyerɛ ase yiye.
<p>Nsɛm a wɔakyerɛw no nhwɛso wɔ ha...</p>
Wubetumi de nea wopɛ aka ho.pre-scrollable
adesuakuw no aka ho, a ɛbɛma max-height a ɛyɛ 350px na ama y-axis scrollbar.
Sɛ wopɛ sɛ wokyerɛ variables a, fa <var>
tag no di dwuma.
y = m x + b
Sɛ wopɛ sɛ wokyerɛ blocks sample output fi program bi mu a, fa <samp>
tag no di dwuma.
Wɔayɛ sɛ wɔbɛfa saa nkyerɛwee yi sɛ nhwɛsode a efi kɔmputa so dwumadi bi mu ba.
Sɛ wopɛ sɛ woyɛ nneɛma titiriw a wɔde yɛ nneɛma—a wɔde hyɛ mu a ɛyɛ hare ne nneɛma a wɔde kyekyɛ nneɛma mu a ɛkɔ soro nkutoo a—fa nnyinaso adesuakuw .table
no ka biara <table>
ho . Ebia ɛbɛyɛ te sɛ nea ɛyɛ super redundant, nanso esiane sɛ wɔde tables di dwuma kɛse ma plugins afoforo te sɛ kalenda ne date pickers nti, yɛapaw sɛ yɛbɛtew yɛn custom table styles no ho.
# . | Fie din | Abusuadin | Edin a wɔde di dwuma |
---|---|---|---|
1. 1. | Marko | Otto na ɔkyerɛwee | @mdo na ɔkyerɛwee |
2. 2. | Yakob | Thornton na ɔkyerɛwee | @kɛseɛ |
3. 3 | Larry na ɔkyerɛwee | Anomaa no | @twitter so |
Fa di dwuma .table-striped
de zebra-striping ka table row biara a ɛwɔ <tbody>
.
Wɔnam :nth-child
CSS selector a enni Internet Explorer 8 mu no so na ɛyɛ pon ahorow a ɛwɔ nsensanee no su.
# . | Fie din | Abusuadin | Edin a wɔde di dwuma |
---|---|---|---|
1. 1. | Marko | Otto na ɔkyerɛwee | @mdo na ɔkyerɛwee |
2. 2. | Yakob | Thornton na ɔkyerɛwee | @kɛseɛ |
3. 3 | Larry na ɔkyerɛwee | Anomaa no | @twitter so |
Fa ka ho .table-bordered
ma borders wɔ table no afã nyinaa ne cells.
# . | Fie din | Abusuadin | Edin a wɔde di dwuma |
---|---|---|---|
1. 1. | Marko | Otto na ɔkyerɛwee | @mdo na ɔkyerɛwee |
2. 2. | Yakob | Thornton na ɔkyerɛwee | @kɛseɛ |
3. 3 | Larry na ɔkyerɛwee | Anomaa no | @twitter so |
Fa ka .table-hover
ho na ama hover tebea bi ayɛ adwuma wɔ table rows a ɛwɔ a <tbody>
.
# . | Fie din | Abusuadin | Edin a wɔde di dwuma |
---|---|---|---|
1. 1. | Marko | Otto na ɔkyerɛwee | @mdo na ɔkyerɛwee |
2. 2. | Yakob | Thornton na ɔkyerɛwee | @kɛseɛ |
3. 3 | Larry na ɔkyerɛwee | Anomaa no | @twitter so |
Fa ka .table-condensed
ho na ama pon ahorow no ayɛ ketewaa denam cell padding a wubetwitwa mu abien no so.
# . | Fie din | Abusuadin | Edin a wɔde di dwuma |
---|---|---|---|
1. 1. | Marko | Otto na ɔkyerɛwee | @mdo na ɔkyerɛwee |
2. 2. | Yakob | Thornton na ɔkyerɛwee | @kɛseɛ |
3. 3 | Larry Anomaa no | @twitter so |
Fa nsɛm a ɛfa ho adesua ahorow di dwuma de kɔla pon row anaa nkwammoaa ankorankoro.
Klaase | Nkyerɛmu |
---|---|
.active |
Fa hover kɔla no di dwuma wɔ row anaa cell pɔtee bi so |
.success |
Ɛkyerɛ adeyɛ a edi mu anaasɛ ɛyɛ papa |
.info |
Kyerɛ nsakrae anaa adeyɛ a ɛma nsɛm a ɛnyɛ afã biara |
.warning |
Kyerɛ kɔkɔbɔ bi a ebia ebehia sɛ wɔde wɔn adwene si so |
.danger |
Ɛkyerɛ adeyɛ a asiane wom anaasɛ ebetumi ayɛ bɔne |
# . | Kɔla asɛmti | Kɔla asɛmti | Kɔla asɛmti |
---|---|---|---|
1. 1. | Nsɛm a ɛwɔ column no mu | Nsɛm a ɛwɔ column no mu | Nsɛm a ɛwɔ column no mu |
2. 2. | Nsɛm a ɛwɔ column no mu | Nsɛm a ɛwɔ column no mu | Nsɛm a ɛwɔ column no mu |
3. 3 | Nsɛm a ɛwɔ column no mu | Nsɛm a ɛwɔ column no mu | Nsɛm a ɛwɔ column no mu |
4. 4. | Nsɛm a ɛwɔ column no mu | Nsɛm a ɛwɔ column no mu | Nsɛm a ɛwɔ column no mu |
5. 5 | Nsɛm a ɛwɔ column no mu | Nsɛm a ɛwɔ column no mu | Nsɛm a ɛwɔ column no mu |
6. 6 | Nsɛm a ɛwɔ column no mu | Nsɛm a ɛwɔ column no mu | Nsɛm a ɛwɔ column no mu |
7. 7 | Nsɛm a ɛwɔ column no mu | Nsɛm a ɛwɔ column no mu | Nsɛm a ɛwɔ column no mu |
8 | Nsɛm a ɛwɔ column no mu | Nsɛm a ɛwɔ column no mu | Nsɛm a ɛwɔ column no mu |
9. 9 | Nsɛm a ɛwɔ column no mu | Nsɛm a ɛwɔ column no mu | Nsɛm a ɛwɔ column no mu |
Sɛ wode kɔla di dwuma de ntease ka pon so row anaa ankorankoro nkwammoaa ho a, ɛma wonya sɛnkyerɛnne a wotumi hu nkutoo, a wɔremfa nkɔma wɔn a wɔde mfiridwuma a ɛboa di dwuma – te sɛ screen akenkanfo. Hwɛ sɛ nsɛm a wɔde kɔla no akyerɛ no da adi pefee fi emu nsɛm no ankasa mu (nkyerɛwee a wotumi hu wɔ pon row/cell a ɛfa ho no mu), anaasɛ wɔde bɛka ho denam akwan foforo so, te sɛ nsɛm foforo a wɔde asie ne .sr-only
adesuakuw no mu.
Yɛ mmuaeɛ pon denam biara a wobɛkyekyere .table
mu .table-responsive
ama atumi akɔ soro wɔ mfiri nketewa so (wɔ 768px ase). Sɛ worehwɛ biribiara a ɛso sen 768px tɛtrɛtɛ so a, worenhu nsonsonoe biara wɔ saa pon ahorow yi mu.
Responsive tables make use of overflow-y: hidden
, a ɛtwitwa nsɛm biara a ɛkɔ akyiri sen table no ase anaa atifi anoano. Titiriw no, eyi betumi atwitwa dropdown menus ne afoforo widgets afoforo so.
Firefox wɔ fieldset styling bi a ɛyɛ fɛre a ɛfa ho width
a ɛtwetwe mmuae pon no. Eyi ntumi nhyɛ so a Firefox-specific hack a yɛmfa mma wɔ Bootstrap mu nni mu:
Sɛ wopɛ nsɛm pii a, kenkan Stack Overflow mmuae yi .
# . | Table asɛmti | Table asɛmti | Table asɛmti | Table asɛmti | Table asɛmti | Table asɛmti |
---|---|---|---|---|---|---|
1. 1. | Table cell | Table cell | Table cell | Table cell | Table cell | Table cell |
2. 2. | Table cell | Table cell | Table cell | Table cell | Table cell | Table cell |
3. 3 | Table cell | Table cell | Table cell | Table cell | Table cell | Table cell |
# . | Table asɛmti | Table asɛmti | Table asɛmti | Table asɛmti | Table asɛmti | Table asɛmti |
---|---|---|---|---|---|---|
1. 1. | Table cell | Table cell | Table cell | Table cell | Table cell | Table cell |
2. 2. | Table cell | Table cell | Table cell | Table cell | Table cell | Table cell |
3. 3 | Table cell | Table cell | Table cell | Table cell | Table cell | Table cell |
Ankorankoro form controls no ankasa nya wiase nyinaa styling bi. Wɔde textual <input>
, <textarea>
, ne <select>
elements a ɛwɔ .form-control
nyinaa ahyɛ width: 100%;
default so. Fa nkyerɛwde ne nneɛma a wɔde di dwuma no kyekyere mu na .form-group
ama woanya ntam kwan a eye sen biara.
Mfa form akuw nfrafra nsɛm a wɔde hyɛ mu akuw no mu tẽẽ . Mmom, nest input kuw no wɔ fom kuw no mu.
Fa ka .form-inline
wo kratasin no ho (a ɛnsɛ sɛ ɛyɛ <form>
) ma benkum so ne inline-block controls. Eyi fa nkrataa a ɛwɔ viewports mu a anyɛ yiye koraa no ne tɛtrɛtɛ yɛ 768px nkutoo ho.
Inputs ne selects ayɛ width: 100%;
adwuma default wɔ Bootstrap mu. Wɔ inline nkrataa mu no, yɛsan de saa no kɔ width: auto;
sɛnea ɛbɛyɛ a control ahorow pii betumi atra line koro no ara so. Ɛgyina wo nhyehyɛe so no, ebia ɛho behia sɛ wode custom widths afoforo di dwuma.
Screen akenkanfoɔ bɛnya ɔhaw wɔ wo nkrataa no ho sɛ woamfa label anhyɛ biribiara a wode bɛhyɛ mu no mu a. Wɔ saa inline nkrataa yi ho no, wubetumi de .sr-only
adesuakuw no asie nkyerɛwde ahorow no. Akwan foforo wɔ hɔ a wɔfa so de ahyɛnsode ma mfiridwuma a ɛboa, te sɛ aria-label
, aria-labelledby
anaa title
su no. Sɛ eyinom mu biara nni hɔ a, screen akenkanfo betumi de placeholder
su no adi dwuma, sɛ ɛwɔ hɔ a, nanso hyɛ no nsow sɛ wɔmfa nni dwuma placeholder
sɛ nea wɔde besi akwan afoforo a wɔfa so kyerɛw nsɛm no ananmu.
Fa Bootstrap grid adesua ahorow a wɔadi kan akyerɛkyerɛ mu no hyehyɛ nkyerɛwde ne akuw a ɛwɔ fom controls mu wɔ horizontal layout mu denam ka a wode bɛka .form-horizontal
fom no ho (a enhia sɛ ɛyɛ a <form>
). Saa a wobɛyɛ no sesa .form-group
s ma ɛyɛ n’ade sɛ grid rows, enti enhia sɛ .row
.
Nhwɛsoɔ a ɛfa standard form controls a wɔboa wɔ nhwɛsoɔ form layout mu.
Fom sohwɛ a wɔtaa de di dwuma, nsɛm a wɔde hyɛ mu a egyina nsɛm so. Nea ɛka ho ne mmoa a wɔde ma HTML5 ahorow nyinaa: text
, password
, datetime
, datetime-local
, date
, month
, time
, week
, number
, email
, url
, search
, tel
, ne color
.
Inputs no bɛyɛ fully styled nkutoo sɛ wɔn type
de no dawurubɔ yiye a.
Sɛ wode nsɛm a wɔaka abom anaa bɔtɔn ahorow bɛka ho ansa na ne/anaasɛ nsɛm biara a egyina nsɛm so akyi a <input>
, hwɛ input kuw no fã no .
Form control a ɛboa nkyerɛwee ahorow pii. Sesa rows
su no sɛnea ɛho hia.
Nnaka a wɔde hyɛ mu no yɛ nea wɔde paw nneɛma biako anaa pii wɔ list bi mu, bere a radio ahorow no yɛ nea wɔde paw ɔkwan biako fi pii mu.
Wɔboa checkboxes ne radio ahorow a wɔagyae mu, nanso sɛ wode "wɔmma ho kwan" cursor bɛma wɔ hover of the parent <label>
, ɛho behia sɛ wode .disabled
class no bɛka ɔwofo .radio
no ho , .radio-inline
, .checkbox
, anaa .checkbox-inline
.
Fa .checkbox-inline
anaa .radio-inline
adesua ahorow no di dwuma wɔ checkbox anaa radio ahorow a ɛtoatoa so so ma control ahorow a epue wɔ line koro no ara so.
Sɛ ɛsɛ sɛ wunya nsɛm biara wɔ , no mu a <label>
, wɔde nsɛm a wode bɛba no si hɔ sɛnea wobɛhwɛ kwan no. Mprempren ɛyɛ adwuma wɔ checkbox a ɛnyɛ inline ne radio nkutoo so. Kae sɛ wobɛda so ara de nkyerɛwde bi ama mfiridwuma a ɛboa (sɛ nhwɛso no, sɛ wode bedi dwuma aria-label
).
Hyɛ no nsow sɛ native select menu pii—a ɛne Safari ne Chrome mu—wɔ ntwea a ɛyɛ kurukuruwa a wontumi mfa border-radius
agyapade ahorow so nsakra.
Wɔ <select>
controls a ɛwɔ multiple
attribute no, wɔakyerɛ options pii default.
Sɛ ɛho hia sɛ wode nsɛm a ɛnyɛ den si fom nkyerɛwde bi nkyɛn wɔ kratasin bi mu a, fa .form-control-static
adesuakuw no di dwuma wɔ <p>
.
Yɛyi default outline
styles a ɛwɔ form controls bi so no na yɛde a box-shadow
si n’ananmu ma :focus
.
:focus
tebea noAtifi hɔ nhwɛso input no de custom styles di dwuma wɔ yɛn nkrataa mu de kyerɛ :focus
tebea no wɔ a .form-control
.
Fa disabled
boolean attribute no ka ho wɔ input bi so na asiw ɔdefo nkitahodi ano. Nsɛm a wɔde ahyɛ mu a wɔabara no da adi sɛ ɛyɛ hare na ɛde not-allowed
cursor ka ho.
Fa disabled
attribute no ka a ho na <fieldset>
ama controls a ɛwɔ mu no nyinaa ayɛ adwuma <fieldset>
prɛko pɛ.
<a>
Sɛnea wɔahyɛ no, browser ahorow no bɛfa native form controls ( <input>
, <select>
ne <button>
elements) a ɛwɔ a mu <fieldset disabled>
nyinaa sɛ wɔagyae, na asiw keyboard ne mouse nkitahodi nyinaa ano wɔ wɔn so. Nanso, sɛ wo kratasin no nso de <a ... class="btn btn-*">
nneɛma bi ka ho a, wɔbɛma eyinom kwan a ɛyɛ pointer-events: none
. Sɛnea wɔahyɛ no nsow wɔ ɔfa a ɛfa tebea a wɔadi dɛm ho ma bɔtn (na titiriw wɔ ɔfa ketewa a ɛfa ankora nneɛma ho), saa CSS agyapade yi nnya nyɛɛ gyinapɛn na wonnya mmoa koraa wɔ Opera 18 ne nea ɛba fam, anaasɛ wɔ Internet Explorer 11 mu, na wodii nkonim 't nsiw keyboard dwumadiefoɔ kwan sɛ wɔbɛtumi de wɔn adwene asi so anaasɛ wɔbɛma saa links yi ayɛ adwuma. Enti sɛnea ɛbɛyɛ a wubenya ahobammɔ no, fa JavaScript a wɔahyɛ da ayɛ no di dwuma na ma link ahorow a ɛtete saa no nyɛ adwuma.
Bere a Bootstrap de saa akwan yi bedi dwuma wɔ browser ahorow nyinaa mu no, Internet Explorer 11 ne nea ɛwɔ ase ha no ntumi mmoa disabled
su no koraa wɔ <fieldset>
. Fa JavaScript a wɔahyɛ da ayɛ no di dwuma na ma fieldset no nyɛ adwuma wɔ browser ahorow yi mu.
Fa readonly
boolean attribute no ka ho wɔ input bi so na asiw nsakrae a ɛbɛba input no bo no ano. Nsɛm a wɔde kenkan nkutoo no da adi sɛ ɛyɛ hare (te sɛ nsɛm a wɔde hyɛ mu a wɔagyae mu no ara pɛ), nanso kura cursor a ɛwɔ hɔ no mu.
Block level mmoa nsɛm ma fom controls.
Ɛsɛ sɛ mmoa nsɛm no bata krataa sohwɛ a ɛfa aria-describedby
su no a wɔde bedi dwuma ho no ho pefee. Wei bɛhwɛ sɛ mfiridwuma a ɛboa – te sɛ screen readers – bɛbɔ saa mmoa nsɛm yi ho amanneɛ bere a nea ɔde di dwuma no de n’adwene si so anaasɛ ɔhyɛn control no mu.
Bootstrap no de validation styles ma mfomso, kɔkɔbɔ, ne nkonimdi tebea wɔ fom controls so ka ho. Sɛ wode bedi dwuma a, fa .has-warning
, .has-error
, anaa .has-success
ka ɔwofo element no ho. .control-label
, , biara .form-control
ne .help-block
saa element no mu no benya validation styles no.
Sɛ wode saa validation styles yi di dwuma de kyerɛ tebea a ɛwɔ form control bi mu a, ɛma wonya aniwa, kɔla a egyina so kyerɛ nkutoo, a wɔremfa nkɔma wɔn a wɔde mfiridwuma a ɛboa di dwuma - te sɛ screen akenkanfo - anaasɛ wɔn a wɔde di dwuma a wonni kɔla.
Hwɛ sɛ wɔde ɔman ho sɛnkyerɛnne foforo nso bɛma. Sɛ nhwɛsoɔ no, wobɛtumi de hint fa state ho ahyɛ form control no <label>
nkyerɛwee no ankasa mu (sɛdeɛ ɛteɛ wɔ code nhwɛsoɔ a ɛdidi soɔ yi mu), wode Glyphicon ahyɛ mu (a nsɛm foforɔ a ɛfata a wode bedi dwuma de .sr-only
adesua no di dwuma - hwɛ Glyphicon nhwɛsoɔ no ), anaasɛ wode an mmoa foforo text block. Titiriw wɔ mmoa mfiridwuma ho no, wobetumi nso de aria-invalid="true"
su bi ama form controls a enni mu.
Wubetumi nso de nsɛm a wɔde ma ho ahyɛnsode ahorow a wopɛ aka ho a wode ahyɛnsode a ɛwɔ .has-feedback
ne nifa no aka ho.
Feedback icons no de nkyerɛwee <input class="form-control">
mu nneɛma nkutoo na ɛyɛ adwuma.
Nsaano gyinabea a wɔde nsɛm a wɔde bɛma ahyɛnsode ahorow no besisi hɔ no ho hia ma nsɛm a wɔde hyɛ mu a enni nkyerɛwde ne nsɛm a wɔde hyɛ mu akuw a wɔde biribi ka ho wɔ nifa so. Yɛhyɛ wo nkuran denneennen sɛ fa nkyerɛwde ahorow ma nneɛma a wɔde hyɛ mu nyinaa esiane sɛ wobetumi anya bi nti. Sɛ wopɛ sɛ wosiw nkyerɛwde ahorow a wɔbɛda no adi no kwan a, fa sie ne .sr-only
adesuakuw no. Sɛ ɛsɛ sɛ woyɛ a wonni labels a, sesa top
bo a ɛwɔ feedback icon no so. Wɔ input akuo ho no, sesa right
botae no ma ɛnyɛ pixel bo a ɛfata a egyina wo addon no trɛw so.
Sɛnea ɛbɛyɛ a wɔbɛhwɛ sɛ mfiridwuma a ɛboa – te sɛ screen readers – da ahyɛnsode bi asekyerɛ adi yiye no, ɛsɛ sɛ wɔde nsɛm foforo a ahintaw ka .sr-only
adesuakuw no ho na wɔde bata krataa sohwɛ a ɛfa sɛnea wɔde di dwuma no ho pefee aria-describedby
. Sɛnea ɛbɛyɛ foforo no, hwɛ hu sɛ wɔde ntease no (sɛ nhwɛso no, nokwasɛm a ɛyɛ sɛ kɔkɔbɔ bi wɔ hɔ ma nsɛm a wɔde hyɛ mu no afã pɔtee bi) no bɛda adi wɔ ɔkwan foforo bi so, te sɛ nsakrae a ɛfa nsɛm a ɛwɔ ankasa <label>
a ɛbata krataa no sohwɛ ho no ho.
Ɛwom sɛ nhwɛso ahorow a edidi so yi ka wɔn mu biara form controls no validation tebea ho asɛm dedaw wɔ <label>
nkyerɛwee no ankasa mu de, nanso wɔde atifi hɔ ɔkwan no (a wɔde .sr-only
nsɛm ne aria-describedby
) di dwuma no aka ho de ayɛ nhwɛso.
.sr-only
nkyerɛwde ahorow ahintaw womSɛ wode .sr-only
class no sie form control's <label>
(sen sɛ wode labeling options afoforo bedi dwuma, te sɛ aria-label
attribute no), Bootstrap bɛsesa icon no gyinabea ankasa bere a wɔde aka ho no.
Set heights fa classes te sɛ .input-lg
, na hyehyɛ widths fa grid column classes te sɛ .col-lg-*
.
Yɛ form controls atenten anaa tiawa a ɛne button akɛse hyia.
Ntɛmntɛm size labels ne form controls mu .form-horizontal
denam .form-group-lg
anaa .form-group-sm
.
Fa nsɛm a wɔde ahyɛ mu no kyekyere grid columns mu, anaasɛ ɔwofo element biara a wɔahyɛ da ayɛ, na ama ɛnyɛ den sɛ ɛbɛhyɛ ntrɛwmu a wopɛ no mu den.
Fa button adesua ahorow no di dwuma wɔ an<a>
, <button>
, anaa <input>
element bi so.
Bere a wobetumi de button classes adi dwuma wɔ <a>
ne <button>
elements so no, <button>
elements nkutoo na wɔboa wɔ yɛn nav ne navbar components no mu.
Sɛ wɔde <a>
nneɛma no di dwuma sɛ bɔtɔn – ɛkanyan krataafa no mu dwumadi, sen sɛ wobɛkɔ krataa anaa ɔfã foforo a ɛwɔ kratafa a ɛwɔ hɔ mprempren no mu – ɛsɛ sɛ wɔma wɔn nso role="button"
.
Sɛ́ adeyɛ a eye sen biara no, yɛkamfo kyerɛ kɛse sɛ fa <button>
element no di dwuma bere biara a ɛbɛyɛ yiye na ama woahwɛ ahu sɛ cross-browser nkyerɛase no hyia.
Nea ɛka nneɛma foforo ho no, mfomso bi wɔ Firefox <30 mu a ɛmma yentumi nsiesie line-height
of <input>
-based buttons no, ɛma ɛne button afoforo a ɛwɔ Firefox so no sorokɔ nhyia pɛpɛɛpɛ.
Fa button class ahorow a ɛwɔ hɔ no mu biara di dwuma fa yɛ button a wɔayɛ no style ntɛmntɛm.
Sɛ wode kɔla di dwuma de ntease ka bɔtn bi ho a, ɛma wonya sɛnkyerɛnne a wotumi hu nkutoo, a wɔremfa nkɔma wɔn a wɔde mfiridwuma a ɛboa di dwuma – te sɛ screen akenkanfo. Hwɛ sɛ nsɛm a wɔde kɔla no kyerɛ no da adi pefee fi emu nsɛm no ankasa mu (bɔt no mu nsɛm a wotumi hu), anaasɛ wɔde bɛka ho denam akwan foforo so, te sɛ nsɛm foforo a wɔde asie ne .sr-only
adesuakuw no mu.
Fancy akɛse anaa nketewa buttons? Fa .btn-lg
, .btn-sm
, anaa .btn-xs
ka ho sɛ wopɛ sɛ wunya akɛse afoforo a.
Yɛ block level buttons—nea ɛtrɛw ɔwofo bi ntrɛwmu nyinaa mu—denam .btn-block
.
Bɔtɔn ahorow no bɛda adi sɛ woamia (a akyi yɛ tuntum, ɔhye a ɛyɛ tuntum, ne sunsuma a wɔde ahyɛ mu) bere a ɛreyɛ adwuma no. Wɔ <button>
element ahorow ho no, wɔyɛ eyi denam :active
. Wɔ <a>
elements ho no, wɔde .active
. Nanso, wubetumi de adi dwuma .active
wɔ <button>
s so (na wode no aka hoaria-pressed="true"
su no aka ho) sɛ ɛho hia sɛ wosan yɛ tebea a ɛyɛ adwuma no wɔ nhyehyɛe kwan so a.
Ɛho nhia sɛ wode bɛka ho :active
sɛnea ɛyɛ pseudo-class, nanso sɛ ɛho hia sɛ wohyɛ anim koro no ara a, kɔ w’anim na fa ka ho .active
.
Fa .active
adesuakuw no ka <a>
bɔtn ahorow ho.
Ma button ahorow no nyɛ te sɛ nea wuntumi nkɔ so denam fade a wode bɛsan ayɛ no so opacity
.
Fa disabled
su no ka <button>
bɔtn ahorow ho.
Sɛ wode disabled
attribute no ka a <button>
, Internet Explorer 9 ne nea ɛwɔ ase ha no bɛma nsɛm no ayɛ fitaa a nkyerɛwee-sunsuma a ɛyɛ abofono a yentumi nsiesie.
Fa .disabled
adesuakuw no ka <a>
bɔtn ahorow ho.
Yɛde di dwuma .disabled
sɛ utility class wɔ ha, a ɛte sɛ common .active
class no, enti prefix biara ho nhia.
Saa adesua yi de di dwuma pointer-events: none
de bɔ mmɔden sɛ ɛbɛma s no link dwumadie no ayɛ adwuma <a>
, nanso saa CSS agyapadeɛ no nnya nyɛɛ standardized na ɛnnya mmoa koraa wɔ Opera 18 ne nea ɛwɔ aseɛ ha, anaa Internet Explorer 11. Nea ɛka ho no, mpo wɔ browsers a ɛboa pointer-events: none
, keyboard akwantuo no da so ara nnyaa nkɛntɛnsoɔ biara, a ɛkyerɛ sɛ wɔn a wɔde keyboard di dwuma a wɔhunu adeɛ ne wɔn a wɔde mfiridwuma a ɛboa di dwuma no bɛda so ara atumi de saa nkitahodiɛ yi ayɛ adwuma. Enti sɛnea ɛbɛyɛ a wubenya ahobammɔ no, fa JavaScript a wɔahyɛ da ayɛ no di dwuma na ma link ahorow a ɛtete saa no nyɛ adwuma.
Mfonini ahorow a ɛwɔ Bootstrap 3 mu no betumi ayɛ nea ɛyɛ mmuae-adamfofa denam .img-responsive
adesuakuw no a wɔde bɛka ho no so. Eyi fa max-width: 100%;
, height: auto;
ne display: block;
mfonini no ho sɛnea ɛbɛyɛ a ɛbɛsrɛ fɛfɛɛfɛ akɔ ɔwofo element no so.
Sɛ wode mfonini ahorow a ɛde adesuakuw no di dwuma no mfinimfini a .img-responsive
, fa di dwuma .center-block
sen sɛ wode .text-center
. Hwɛ aboafoɔ adesua ɔfa no ma nsɛm pii fa .center-block
dwumadie ho.
Wɔ Internet Explorer 8-10 mu no, SVG mfonini ahorow a ɛwɔ .img-responsive
no kɛse a ɛnsɛ. Sɛ wopɛ sɛ wusiesie eyi a, fa ka ho width: 100% \9;
wɔ baabi a ɛho hia. Bootstrap mfa eyi nni dwuma ankasa efisɛ ɛde nsɛnnennen ba mfonini ahorow afoforo so.
Fa adesua ahorow ka <img>
element bi ho na ama ayɛ mmerɛw sɛ wobɛhyehyɛ mfonini ahorow wɔ adwuma biara mu.
Ma ɛntra w’adwenem sɛ Internet Explorer 8 nni mmoa ma ntwea a ɛyɛ kurukuruwa.
Da ntease adi denam kɔla so denam nsa kakraa bi a wosi so dua mfaso adesua ahorow so. Ebia eyinom nso betumi adi dwuma wɔ link ahorow so na ɛbɛyɛ sum wɔ hover so te sɛ yɛn default link styles no ara pɛ.
Fusce dapibus, tellus ac nnome commodo, tortor mauris nibh.
Nullam id dolor id nibh ultricies kar a wɔde di dwuma wɔ ɔkwan a ɛfata so.
Duis mollis, est a ɛnyɛ commodo luctus, nisi erat porttitor ligula.
Maecenas sed diam eget risus varius blandit tena ase a ɛnyɛ magna.
Etiam porta sem ɔbarima a ɔyɛ ɔbarima a ɔyɛ ɔbarima.
Donec ullamcorper nulla a ɛnyɛ nea ɛyɛ adetɔnfo fringilla.
Ɛtɔ da bi a, wontumi mfa adesua ahorow a wosi so dua no nni dwuma esiane sɛnea ɔpawfo foforo no yɛ pɔtee nti. Mpɛn pii no, adeyɛ a ɛdɔɔso ne sɛ wobɛkyekyere wo nsɛm no wɔ a <span>
ne adesuakuw no mu.
Kɔla a wɔde di dwuma de ntease ka ho no ma wonya sɛnkyerɛnne a wotumi hu nkutoo, a wɔremfa nkɔma wɔn a wɔde mfiridwuma a ɛboa di dwuma – te sɛ screen akenkanfo. Hwɛ sɛ nsɛm a wɔde kɔla no kyerɛ no da adi pefee fi emu nsɛm no ankasa mu (wɔde kɔla ahorow a ɛwɔ nsɛm no mu no di dwuma de hyɛ ntease a ɛwɔ nkyerɛwee/agyiraehyɛde no mu dedaw no mu den nkutoo), anaasɛ wɔde bɛka ho denam akwan foforo so, te sɛ nsɛm foforo a wɔde asie ne .sr-only
adesuakuw no mu .
Te sɛ nsɛm a ɛfa nsɛm ho kɔla adesua ahorow no, ɛnyɛ den sɛ wode element bi akyi nsɛm besi nsɛm a ɛfa nsɛm ho adesua biara so. Anchor components bɛyɛ sum wɔ hover so, te sɛ text classes no ara pɛ.
Nullam id dolor id nibh ultricies kar a wɔde di dwuma wɔ ɔkwan a ɛfata so.
Duis mollis, est a ɛnyɛ commodo luctus, nisi erat porttitor ligula.
Maecenas sed diam eget risus varius blandit tena ase a ɛnyɛ magna.
Etiam porta sem ɔbarima a ɔyɛ ɔbarima a ɔyɛ ɔbarima.
Donec ullamcorper nulla a ɛnyɛ nea ɛyɛ adetɔnfo fringilla.
Ɛtɔ da bi a, wontumi mfa nsɛm a ɛfa ho akyi adesua ahorow nni dwuma esiane sɛ ɔpawfo foforo no pɔtee nti. Wɔ tebea horow bi mu no, adwumayɛ a ɛdɔɔso ne sɛ wobɛkyekyere wo element no mu nsɛm no wɔ a <div>
ne adesuakuw no mu.
Sɛnea ɛte wɔ kɔla ahorow a ɛfa nsɛm ho no , hwɛ hu sɛ ntease biara a ɛnam kɔla so da no adi nso wɔ ɔkwan a ɛnyɛ nkyerɛkyerɛmu ara kwa so.
Fa generic close icon no di dwuma ma pow nsɛm te sɛ modals ne kɔkɔbɔ ahorow.
Fa carets kyerɛ sɛnea dropdown no yɛ adwuma ne akwankyerɛ. Hyɛ no nsow sɛ default caret no bɛdannan ne ho wɔ dropup menus mu .
Fa element bi hyɛ benkum anaa nifa so ne adesuakuw bi. !important
no ka ho na ama wɔakwati nsɛm pɔtee a ɛfa nneɛma pɔtee bi ho. Wobetumi nso de adesua ahorow adi dwuma sɛ mixins.
Fa element bi si display: block
ne mfinimfini via margin
. Ɛwɔ hɔ sɛ mixin ne adesuakuw.
Ɛnyɛ den sɛ wobɛtew float
s so denam .clearfix
ɔwofo element no a wode bɛka ho no so . Ɔde micro clearfix no di dwuma sɛnea Nicolas Gallagher gyee din no. Wobetumi nso de adi dwuma sɛ mixin.
Hyɛ element bi ma wɔmfa nkyerɛ anaa wɔmfa nsie ( a screen akenkanfo ka ho ) denam .show
ne .hidden
adesua ahorow a wɔde di dwuma so. Saa adesuakuw ahorow yi de di dwuma !important
de kwati ntawntawdi a ɛfa nneɛma pɔtee bi ho, te sɛ nea ɛsensɛn nsu so ntɛmntɛm no ara pɛ . Wɔn wɔ hɔ ma block level toggling nkutoo. Wobetumi nso de adi dwuma sɛ mixins.
.hide
no wɔ hɔ, nanso ɛnyɛ bere nyinaa na ɛka screen akenkanfo na wɔagyae adwuma no fi v3.0.1. Fa .hidden
anaa .sr-only
mmom di dwuma.
Bio nso, .invisible
wobetumi de adi dwuma de toggle nkutoo visibility of element, a ɛkyerɛ sɛ ne display
nsakrae na element no da so ara betumi aka flow no krataa no.
Fa element bi sie mfiri nyinaa gye sɛ screen akenkanfo a wɔde .sr-only
. Ka bom .sr-only
ne .sr-only-focusable
fa kyerɛ element no bio bere a ɛde n’adwene asi so (sɛ nhwɛso no, obi a ɔde keyboard nkutoo di dwuma). Ɛho hia ma nneyɛe pa a ɛfa akwan a wɔfa so nya nneɛma ho akyi . Wobetumi nso de adi dwuma sɛ mixins.
Fa .text-hide
adesua anaa mixin no boa ma wɔde akyi mfonini si element bi nkyerɛwee mu nsɛm ananmu.
Sɛ wopɛ sɛ wonya nkɔsoɔ a ɛyɛ ntɛm a ɛyɛ mobile-friendly a, fa saa utility classes yi di dwuma ma kyerɛ na wode nneɛma sie denam mfiri so denam media abisadeɛ so. Afei nso, utility classes a wɔde toggling content bere a wɔatintim no ka ho.
Bɔ mmɔden sɛ wode eyinom bedi dwuma kakraa bi na kwati sɛ wobɛyɛ wɛbsaet koro no ara nkyerɛase ahorow a ɛsono emu biara koraa. Mmom no, fa di dwuma de ka mfiri biara a wɔde bɛkyerɛkyerɛ mu no ho.
Fa adesuakuw a ɛwɔ hɔ no biako anaa nea wɔaka abom di dwuma ma toggling nsɛm wɔ viewport breakpoints so.
Mfiri nketewa a ɛboro soTɛlɛfon ahorow (<768px) . | Mfiri nketewa a wɔde yɛ adwumaNnuru a wɔde di dwuma (≥768px) . | Mfiri ahorow a ɛwɔ mfinimfiniNneɛma a wɔde di dwuma wɔ pon so (≥992px) . | Mfiri akɛse a wɔde yɛ adwumaNneɛma a wɔde di dwuma wɔ pon so (≥1200px) . | |
---|---|---|---|---|
.visible-xs-* |
Nea wotumi hu | Asuma | Asuma | Asuma |
.visible-sm-* |
Asuma | Nea wotumi hu | Asuma | Asuma |
.visible-md-* |
Asuma | Asuma | Nea wotumi hu | Asuma |
.visible-lg-* |
Asuma | Asuma | Asuma | Nea wotumi hu |
.hidden-xs |
Asuma | Nea wotumi hu | Nea wotumi hu | Nea wotumi hu |
.hidden-sm |
Nea wotumi hu | Asuma | Nea wotumi hu | Nea wotumi hu |
.hidden-md |
Nea wotumi hu | Nea wotumi hu | Asuma | Nea wotumi hu |
.hidden-lg |
Nea wotumi hu | Nea wotumi hu | Nea wotumi hu | Asuma |
Ɛde besi v3.2.0 no, .visible-*-*
adesua ahorow a ɛwɔ breakpoint biara mu no ba wɔ nsakrae abiɛsa mu, biako ma CSS display
agyapade bo biara a wɔakyerɛw wɔ ase ha no.
Kuw a ɛwɔ adesuakuw ahorow mu | CSS a ɛwɔ hɔdisplay |
---|---|
.visible-*-block |
display: block; |
.visible-*-inline |
display: inline; |
.visible-*-inline-block |
display: inline-block; |
xs
Enti, sɛ nhwɛso no, wɔ screen nketewa a ɛboro so ho no, .visible-*-*
adesua ahorow a ɛwɔ hɔ no ne: .visible-xs-block
, .visible-xs-inline
, ne .visible-xs-inline-block
.
Classes .visible-xs
, .visible-sm
, .visible-md
, ne .visible-lg
nso wɔ hɔ, nanso wɔagyae sɛnea ɛte wɔ v3.2.0 . Wɔbɛyɛ sɛ ɛne , yɛ pɛ .visible-*-block
, gye sɛ nsɛm titiriw foforo a ɛfa toggling <table>
-related elements ho.
Te sɛ adesua ahorow a wɔde bua nsɛm daa no, fa eyinom di dwuma ma nsɛm a ɛwɔ mu no sesa ma wotintim.
Adesua ahorow | Browser a wɔde di dwuma | |
---|---|---|
.visible-print-block .visible-print-inline .visible-print-inline-block |
Asuma | Nea wotumi hu |
.hidden-print |
Nea wotumi hu | Asuma |
Klas no .visible-print
nso wɔ hɔ nanso wɔagyae sɛnea ɛte wɔ v3.2.0. Ɛbɛyɛ sɛ ɛne , yɛ pɛ .visible-print-block
, gye sɛ nsɛm titiriw foforo a <table>
ɛfa nneɛma a ɛfa -ho ho.
Sesa wo browser no kɛse anaa fa gu mfiri ahorow so de sɔ utility class ahorow a ɛyɛ adwuma no hwɛ.
Green checkmarks kyerɛ sɛ element no da adi wɔ wo mprempren viewport no mu.
Ɛha yi, green checkmarks nso kyerɛ sɛ element no ahintaw wɔ wo mprempren viewport no mu.
Bootstrap no CSS no wɔasi wɔ Less, preprocessor a ɛwɔ dwumadie foforɔ te sɛ variables, mixins, ne dwumadie a wɔde boaboa CSS ano. Wɔn a wɔrehwehwɛ sɛ wɔde source Less fael ahorow no bedi dwuma sen sɛ yɛde yɛn CSS fael ahorow a wɔaboaboa ano no bedi dwuma no betumi de variables ne mixins pii a yɛde di dwuma wɔ framework no nyinaa mu no adi dwuma.
Grid variables ne mixins no wɔakata so wɔ Grid nhyehyɛe ɔfa no mu .
Anyɛ yiye koraa no, wobetumi de Bootstrap adi dwuma wɔ akwan abien so: CSS a wɔaboaboa ano no anaasɛ wɔde fibea Less fael ahorow no. Sɛ wopɛ sɛ woboaboa Less fael ahorow no ano a, hwɛ Getting Started ɔfã no ma sɛnea wobɛhyehyɛ wo nkɔso tebea no ma ayɛ ahyɛde ahorow a ɛho hia no.
Ebia nnwinnade a wɔde boaboa nneɛma ano a ɛto so abiɛsa ne Bootstrap bɛyɛ adwuma, nanso yɛn kuw titiriw no ntumi mmoa.
Wɔde nsakraeɛ di dwuma wɔ adwuma no nyinaa mu sɛ ɔkwan a wɔfa so de mfinimfini na wɔkyɛ botaeɛ a wɔtaa de di dwuma te sɛ kɔla, ntam kwan, anaa font stacks. Sɛ wopɛ sɛ wuhu sɛnea wobɛpaapae mu koraa a, yɛsrɛ wo hwɛ Customizer .
Ɛnyɛ den sɛ wode kɔla ahorow abien bedi dwuma: grayscale ne semantic. Grayscale kɔla ma wonya kwan ntɛm kɔ tuntum shades a wɔtaa de di dwuma bere a semantic ka kɔla ahorow a wɔde ama nsɛm a ɛfa ho a ntease wom.
Fa saa kɔla nsakrae yi mu biara di dwuma sɛnea ɛte anaa san fa ma nsakrae a ntease wom kɛse ma wo dwumadi no.
Nsa kakraa bi a ɛsakra ma wo site no nnompe mu nneɛma atitiriw a wobɛsakra no ntɛmntɛm.
Easily style wo links ne kɔla a ɛfata a ɛwɔ bo biako pɛ.
Hyɛ no nsow sɛ @link-hover-color
de function, adwinnade foforo a ɛyɛ hu a efi Less, di dwuma de yɛ hover kɔla a ɛfata no ankasa. Wubetumi de darken
, lighten
, saturate
, ne desaturate
.
Fa nsakrae kakraa bi a ɛyɛ ntɛm hyehyɛ wo typeface, text size, leading, ne nea ɛkeka ho no ntɛm. Bootstrap de eyinom nso di dwuma de ma typographic mixins a ɛnyɛ den.
Nsakrae abien a ɛyɛ ntɛm a wode bɛsesa beae ne fael din a wo ahyɛnsode ahorow no wɔ.
Nneɛma a ɛwɔ Bootstrap no nyinaa mu no de default variables binom di dwuma de hyehyɛ common values. Nea wɔtaa de di dwuma no ni.
Vendor mixins yɛ mixins a ɛbɛboa ma wɔaboa browser ahorow pii denam vendor prefixes a ɛfa ho nyinaa a wode bɛka wo CSS a woaboaboa ano no ho no so.
Reset wo components' box model no ne mixin biako. Sɛ wopɛ nsɛm a ɛfa ho a, hwɛ asɛm a ɛboa yi a efi Mozilla .
Mixin no yɛ deprecated fi v3.2.0, a wɔde Autoprefixer aba. Sɛnea ɛbɛyɛ a wobɛkora akyi-nhyia so no, Bootstrap bɛkɔ so de mixin no adi dwuma wɔ mu kosi sɛ Bootstrap v4.
Ɛnnɛ nnɛyi browser ahorow nyinaa boa agyapade a ɛnyɛ prefixed border-radius
no. Sɛnea ɛte no, mixin biara nni hɔ .border-radius()
, nanso Bootstrap no de akwan tiawa a wɔfa so yɛ ntwea abien a ɛyɛ kurukuruwa ntɛmntɛm wɔ ade bi fã pɔtee bi no ka ho.
Sɛ w’atiefo a wode w’ani asi wɔn so no de browser ne mfiri a aba foforo na ɛsen biara redi dwuma a, hwɛ hu sɛ wode box-shadow
agyapade no bedi dwuma wɔ n’ankasa mu ara kwa. Sɛ wuhia mmoa ma Android (pre-v4) ne iOS mfiri dedaw (pre-iOS 5) a, fa mixin a wɔagyae no di dwuma fa fa prefix a wɔhwehwɛ no-webkit
.
Mixin no yɛ deprecated sɛ of v3.1.0, efisɛ Bootstrap ntumi mmoa platforms a ne bere atwam a ɛnboa standard property no wɔ aban kwan so. Sɛnea ɛbɛyɛ a wobɛkora akyi-nhyia so no, Bootstrap bɛkɔ so de mixin no adi dwuma wɔ mu kosi sɛ Bootstrap v4.
Hwɛ hu sɛ wode rgba()
kɔla bedi dwuma wɔ wo adaka sunsuma mu sɛnea ɛbɛyɛ a ɛne akyi mfonini ahorow bɛfrafra yiye sɛnea wubetumi.
Mixins pii ma ɛyɛ mmerɛw. Fa biako hyehyɛ nsakrae ho nsɛm nyinaa, anaa kyerɛ bere tenten ne bere tenten a ɛyɛ soronko sɛnea ɛho hia.
Wɔagyae mixins no fi v3.2.0 , a wɔde Autoprefixer aba. Sɛnea ɛbɛyɛ a wobɛkora backwards-compatibility so no, Bootstrap bɛkɔ so de mixins no adi dwuma wɔ mu kosi sɛ Bootstrap v4.
Di akɔneaba, nsenia, kyerɛ ase (tu), anaa skew ade biara.
Wɔagyae mixins no fi v3.2.0 , a wɔde Autoprefixer aba. Sɛnea ɛbɛyɛ a wobɛkora backwards-compatibility so no, Bootstrap bɛkɔ so de mixins no adi dwuma wɔ mu kosi sɛ Bootstrap v4.
Mixin baako a wɔde di dwuma wɔ CSS3 animation agyapadeɛ nyinaa mu wɔ mpaemuka baako mu ne mixin foforɔ ma ankorankoro agyapadeɛ.
Wɔagyae mixins no fi v3.2.0 , a wɔde Autoprefixer aba. Sɛnea ɛbɛyɛ a wobɛkora backwards-compatibility so no, Bootstrap bɛkɔ so de mixins no adi dwuma wɔ mu kosi sɛ Bootstrap v4.
Set opacity ma browsers nyinaa na fa filter
fallback ma IE8.
Fa nsɛm a ɛfa ho ma fom sohwɛ ahorow wɔ afuw biara mu.
Fa CSS so yɛ columns wɔ element biako mu.
Ɛnyɛ den sɛ wobɛdan kɔla abien biara ayɛ no akyi kwan a ɛkɔ soro. Nya nkɔso kɛse na fa akwankyerɛ bi si hɔ, fa kɔla abiɛsa di dwuma, anaa fa radial gradient di dwuma. Sɛ wode mixin biako di dwuma a, wunya prefixed syntaxes a wubehia nyinaa.
Wubetumi nso akyerɛ anim a ɛwɔ kɔla abien a ɛyɛ gyinapɛn, linear gradient:
Sɛ wuhia barber-stripe style gradient a, ɛno nso yɛ mmerɛw. Kyerɛ kɔla biako kɛkɛ na yɛbɛkata translucent white stripe so.
Fa ante no kɔ soro na fa kɔla abiɛsa di dwuma mmom. Fa kɔla a edi kan, kɔla a ɛto so abien, kɔla a ɛto so abien no kɔla gyinabea (ɔha biara mu bo te sɛ 25%), ne kɔla a ɛto so abiɛsa no hyehyɛ saa mixins yi:
Ti a ɛwɔ soro! Sɛ ɛho hia sɛ wuyi gradient bi fi hɔ da bi a, hwɛ hu sɛ wubeyi IE-specific biara filter
a ebia wode aka ho no afi hɔ. Wubetumi ayɛ saa denam .reset-filter()
mixin no a wode bedi dwuma wɔ nkyɛnkyɛn no so background-image: none;
.
Utility mixins yɛ mixins a ɛka CSS agyapade a anka ɛne no nni abusuabɔ bom de du botae anaa adwuma pɔtee bi ho.
Wo werɛ mfi sɛ wode bɛka class="clearfix"
element biara ho na mmom fa .clearfix()
mixin no ka ho wɔ baabi a ɛfata. Ɔde micro clearfix a efi Nicolas Gallagher hɔ no di dwuma .
Fa element biara a ɛwɔ n’awofo mu no hyɛ mfinimfini ntɛm ara. Ɛhwehwɛ width
anaasɛ max-width
ɛsɛ sɛ wɔde si hɔ.
Kyerɛ ade bi nsusuwii a ɛnyɛ den.
Ɛnyɛ den sɛ wobɛhyehyɛ resize options no ama textarea biara, anaa element foforo biara. Defaults kɔ browser suban a ɛfata so ( both
).
Fa ellipsis twa nsɛm no mu ntɛmntɛm denam mixin biako so. Ɛhwehwɛ sɛ element yɛ block
anaasɛ inline-block
level.
Kyerɛ mfonini akwan abien ne @1x mfonini nsusuwii, na Bootstrap bɛma @2x media asɛmmisa. Sɛ wowɔ mfonini pii a wobɛsom a, susuw ho sɛ wode nsa bɛkyerɛw wo retina mfonini CSS wɔ media asɛmmisa biako mu.
Bere a wɔasisi Bootstrap wɔ Less so no, ɛsan nso wɔ Sass hyɛn gyinabea a ɛyɛ aban de . Yɛhwɛ so wɔ GitHub adekorabea soronko bi mu na yɛde nsakrae script di nsɛm foforo ho dwuma.
Esiane sɛ Sass hyɛn gyinabea no wɔ repo soronko na ɛsom atiefo a ɛsono wɔn kakra nti, adwuma no mu nsɛm no yɛ soronko kɛse wɔ Bootstrap adwuma titiriw no ho. Wei hwɛ hu sɛ Sass hyɛn gyinabea no ne nhyehyɛe ahorow pii a egyina Sass so no hyia sɛnea ɛbɛyɛ yiye biara.
Kwan | Nkyerɛmu |
---|---|
lib/ |
Ruby gem code (Sass nhyehyɛe, Rails ne Compass nkabom) . |
tasks/ |
Converter scripts (a ɛdannan upstream Less kɔ Sass) . |
test/ |
Nsɔhwɛ ahorow a wɔde yɛ nneɛma a wɔaboaboa ano |
templates/ |
Kɔmpase a wɔde ahyɛ mu no manifest |
vendor/assets/ |
Sass, JavaScript, ne font fael ahorow |
Rakefile |
Nnwuma a ɛwɔ mu, te sɛ rake ne convert |
Kɔ Sass port no GitHub adekorabea hɔ kɔhwɛ saa fael ahorow yi a ɛreyɛ adwuma.
Sɛ wopɛ nsɛm fa sɛnea wobɛ instɔl na wode Bootstrap for Sass adi dwuma ho a, hwɛ GitHub adekorabea readme . Ɛyɛ fibea a ɛyɛ foforo sen biara na ɛde nsɛm a wɔde bedi dwuma wɔ Rails, Compass, ne Sass nnwuma a ɛwɔ hɔ no ka ho.