Yɛretu akɔ v4 so
Bootstrap 4 yɛ ade titiriw a wɔasan akyerɛw wɔ adwuma no nyinaa ho. Wɔabobɔ nsakrae a ɛda nsow sen biara no so wɔ ase ha, na wɔde nsakrae pɔtee kɛse aba nneɛma a ɛfa ho no akyi.
Nsakrae a egyina pintinn
Sɛ yɛrekɔ Beta 3 so akɔ yɛn v4.x a ɛyɛ den no so a, nsakraeɛ biara nni hɔ a ɛrebubu, nanso nsakraeɛ bi wɔ hɔ a ɛda nsow.
Nsɛm a Wɔtintim
-
Wosiesiee print utilities a asɛe. Kan no, sɛ wɔde
.d-print-*
adesuakuw bi di dwuma a, ɛbɛma wɔabu adesuakuw foforo biara so mpofirim.d-*
. Afei, ɛne yɛn display utilities afoforo no hyia na ɛfa saa media no nkutoo ho (@media print
). -
Wɔatrɛw print display utilities a ɛwɔ hɔ no mu ma ɛne utilities afoforo ahyia. Beta 3 ne nea ɛboro saa nkutoo na na ɔwɔ
block
,inline-block
,inline
, nenone
. Stable v4 a wɔde aka hoflex
,inline-flex
,table
,table-row
, netable-cell
. -
Wɔasiesie print preview rendering wɔ browser ahorow nyinaa so a print styles foforo a ɛkyerɛ
@page
size
.
Beta 3 no sesa
Bere a Beta 2 huu yɛn nsakrae a ɛrebubu no fã kɛse no ara wɔ beta fã no mu no, nanso yɛda so ara wɔ kakraa bi a na ɛsɛ sɛ wodi ho dwuma wɔ Beta 3 a wɔayi no adi no mu. Saa nsakraeɛ yi fa ho sɛ woreyɛ foforɔ akɔ Beta 3 afiri Beta 2 anaa Bootstrap dedaw biara mu a.
Nkekaho
$thumbnail-transition
Woyii variable a wɔmfa nni dwuma no fii hɔ. Na yɛnyɛ nsakrae biara, enti na ɛyɛ extra code kɛkɛ.- npm package no nka fael biara bio gye yɛn source ne dist fael ahorow no; sɛ wode wo ho too wɔn so na na
node_modules
wonam folda no so reyɛ yɛn scripts no a, ɛsɛ sɛ wosakra w’adwumayɛ no.
Nkyerɛwee ahorow
-
San kyerɛw custom ne default checkbox ne radio ahorow no nyinaa. Afei, abien no nyinaa wɔ HTML nhyehyɛe a ɛne no hyia (akyi
<div>
a ɛwɔ sibling<input>
ne<label>
) ne nhyehyɛe ahorow koro no ara (stacked default, inline ne modifier class). Wei ma yɛtumi yɛ style label no gyina input no tebea so, ɛma mmoa a wɔde madisabled
attribute no yɛ mmerɛw (kan no na ɛhwehwɛ sɛ wonya ɔwofo adesua) na ɛboa yɛn form validation no yiye.Sɛ eyi fã no, yɛasesa CSS a wɔde hwɛ
background-image
s pii so wɔ custom form checkboxes ne radio ahorow so. Kane no, na.custom-control-indicator
element a seesei wɔayi afiri hɔ no wɔ akyi kɔla, gradient, ne SVG ahyɛnsodeɛ. Ná akyi a wobɛsesa no kyerɛ sɛ wobɛsesa saa nneɛma no nyinaa bere biara a ɛho behia sɛ wosakra biako pɛ no. Afei, yɛwɔ.custom-control-label::before
ma fill ne gradient na.custom-control-label::after
ɛdi icon no ho dwuma.Sɛ wopɛ sɛ woyɛ custom check inline a, fa ka ho
.custom-control-inline
. -
Wɔayɛ selector a wɔayɛ no foforo ama button akuw a egyina input so. Sɛ anka
[data-toggle="buttons"] { }
yɛde bedi dwuma ama style ne suban no, yɛdedata
attribute no di dwuma ma JS suban ahorow nkutoo na yɛde yɛn ho to.btn-group-toggle
adesuakuw foforo so ma styling. -
Woyii
.col-form-legend
fii hɔ de gye toom sɛ wɔbɛma anya nkɔso kakra.col-form-label
. Saa kwan yi so.col-form-label-sm
na.col-form-label-lg
wobetumi de adi dwuma wɔ<legend>
elements so a ɛnyɛ den. -
Custom file inputs nyaa nsakraeɛ wɔ wɔn
$custom-file-text
Sass variable no mu. Ɛnyɛ nested Sass map bio na seesei ɛma ahoɔden biako pɛ —button noBrowse
sɛnea mprempren ɛno nkutoo ne pseudo-element a wɔayɛ afi yɛn Sass no mu. MpremprenChoose file
nkyerɛwee no fi.custom-file-label
.
Nsɛm a wɔde hyɛ mu akuw ahorow
-
Input kuw addons mprempren yɛ pɔtee ma wɔn beae a ɛfa input bi ho. Yɛagyae
.input-group-addon
na.input-group-btn
ama adesua foforo abien,.input-group-prepend
ne.input-group-append
. Ɛsɛ sɛ wode append anaa prepend di dwuma pefee mprempren, na ɛma yɛn CSS no fã kɛse no ara yɛ mmerɛw. Wɔ append anaa prepend mu no, fa wo buttons no si hɔ sɛnea anka ɛbɛba baabi foforo biara no, nanso fa nsɛm no kyekyere.input-group-text
. -
Mprempren wɔboa validation styles, sɛnea wɔboa inputs pii (ɛwom sɛ wubetumi agye input biako pɛ wɔ kuw biara mu).
-
Ɛsɛ sɛ adesua ahorow a wɔde ma kɛse no yɛ ɔwofo no so
.input-group
na ɛnyɛ ankorankoro form elements no so.
Beta 2 no sesa
Bere a yɛwɔ beta mu no, yɛde asi yɛn ani so sɛ yɛrennya nsakrae biara a ɛbɛpaapae. Nanso, ɛnyɛ bere nyinaa na nneɛma kɔ so sɛnea wɔayɛ ho nhyehyɛe no. Ase hɔ no yɛ nsakrae a ɛrebubu a ɛsɛ sɛ wode tra w’adwenem bere a worekɔ Beta 1 so akɔ Beta 2 no.
Abubuw
- Woayi
$badge-color
variable ne nea wɔde di dwuma wɔ.badge
. Yɛde kɔla nsonsonoe adwuma di dwuma de paw acolor
egyinabackground-color
, enti nsakrae no ho nhia. - Wɔasan din
grayscale()
ayɛ adwuma nogray()
sɛnea ɛbɛyɛ a ɛrensɛe ntawntawdi ne CSS kurom hɔgrayscale
filter no. - Wɔasesa din
.table-inverse
,.thead-inverse
, ne.thead-default
to.*-dark
ne.*-light
, a ɛne yɛn kɔla ahorow a yɛde di dwuma wɔ mmeae afoforo no hyia. - Mprempren pon ahorow a ɛma mmuae no ma adesua ahorow ma grid breakpoint biara. Eyi gyae fi Beta 1 mu sɛ nea
.table-responsive
wode redi dwuma no te sɛ.table-responsive-md
. Afei wubetumi de adi dwuma.table-responsive
anaasɛ.table-responsive-{sm,md,lg,xl}
sɛnea ɛho hia. - Wɔagyae Bower mmoa sɛ wɔagyae package manager no ama akwan foforo (sɛ nhwɛso no, Yarn anaa npm). Hwɛ bower/bower#2298 ma nsɛm no mu nsɛm.
- Bootstrap da so ara hia jQuery 1.9.1 anaa nea ɛboro saa, nanso wɔtu wo fo sɛ fa version 3.x di dwuma efisɛ v3.x browser ahorow a wɔboa no ne nea Bootstrap boa plus v3.x wɔ ahobammɔ nsiesie ahorow bi.
.form-control-label
Woyii adesuakuw a wɔmfa nni dwuma no fii hɔ. Sɛ woyɛɛ saa adesua yi dii dwuma a, na ɛyɛ adesua no duplicate a.col-form-label
ɛde vertically centered a<label>
ne ne ho nsɛm a ɛbata ho wɔ horizontal form layouts mu.- Sesaa no
color-yiq
fi mixin a nacolor
agyapade no ka ho no so kɔɔ adwuma bi a ɛsan de botae bi ba, a ɛma wo kwan ma wode di dwuma ma CSS agyapade biara. Sɛ nhwɛso no, sɛ́color-yiq(#000)
anka wobɛkyerɛwcolor: color-yiq(#000);
.
Nsɛm a Ɛho Hia
- Wɔde dwuma foforo a
pointer-events
wɔde di dwuma wɔ modals so bae. Abɔnten.modal-dialog
no fa nsɛm a esisi mu nepointer-events: none
for custom click handling (a ɛma ɛyɛ yiye sɛ wobɛtie kɛkɛ wɔ the.modal-backdrop
for any clicks), na afei counteracts no ma ankasa.modal-content
no nepointer-events: auto
.
Tɔfabɔ
Tekete nneɛma akɛse a wobɛpɛ sɛ wuhu bere a worekɔ v3 so akɔ v4 no ni.
Browser mmoa a wɔde ma
- Wogyaee IE8, IE9, ne iOS 6 mmoa. v4 mprempren yɛ IE10+ ne iOS 7+ nkutoo. Sɛ wopɛ sɛ wohu saa nsɛm no mu biara a, fa v3 di dwuma.
- Wɔde aban mmoa a wɔde ma Android v5.0 Lollipop no Browser ne WebView kaa ho. Android Browser ne WebView a atwam no da so ara yɛ nea wɔboa no wɔ ɔkwan a ɛnyɛ aban kwan so nkutoo.
Wiase nyinaa nsakrae
- Flexbox no yɛ adwuma default so. Mpɛn pii no eyi kyerɛ sɛ yɛbɛtwe yɛn ho afi floats ne pii afa yɛn components no ho.
- Wɔasesae fii Less so kɔɔ Sass so maa yɛn fibea CSS fael ahorow no.
- Wɔasesa firii
px
kɔrem
sɛ yɛn CSS kuo titire, ɛwom sɛ wɔda so ara de piksel di dwuma ma media nsɛmmisa ne grid suban sɛdeɛ mfiri viewports no nnya type size so nkɛntɛnsoɔ. - Wiase nyinaa font-size kɔɔ soro fi
14px
kosi16px
. - Wɔyɛɛ grid tiers foforo de kaa ɔkwan a ɛto so anum ho (a ɛfa mfiri nketewa ho wɔ
576px
ne ase) na woyii-xs
infix no fii saa adesua ahorow no mu. Nhwɛso:.col-6.col-sm-4.col-md-3
. - Wɔde akwan a wotumi hyehyɛ denam SCSS nsakrae ahorow so (sɛ nhwɛso no,
$enable-gradients: true
) besii asɛmti a ɛyɛ soronko a wobɛpaw no ananmu. - Build system overhauled sɛ wɔde npm scripts a ɛtoatoa so bedi dwuma sen sɛ wɔde Grunt bedi dwuma. Hwɛ
package.json
scripts nyinaa, anaa yɛn project readme ma mpɔtam hɔ nkɔso ahiade. - Bootstrap a wɔmfa nni dwuma a ɛnyɛ mmuaeɛ no, wɔmfa nni dwuma bio.
- Wogyaee intanɛt so Customizer no de gyee nhyehyɛe ho nkrataa a ɛtrɛw kɛse ne adan a wɔahyɛ da ayɛ no akyi.
- Wɔde mfaso adesuakuw foforo du du pii aka ho ama CSS agyapade-botae abien a wɔtaa de di dwuma ne margin/padding spacing shortcuts.
Grid nhyehyɛe
- Wɔde kɔɔ flexbox so.
- Wɔde mmoa a wɔde ma flexbox kaa ho wɔ grid mixins ne adesua ahorow a wɔakyerɛkyerɛ mu dedaw no mu.
- Sɛ́ flexbox no fã no, na mmoa a wɔde ma vertical ne horizontal alignment adesua ahorow no ka ho.
- Wɔayɛ grid adesua din foforo ne grid tier foforo.
- Wɔde
sm
grid tier foforo aka ho wɔ ase hɔ768px
ma granular control pii. Seesei yɛwɔxs
,sm
,md
,lg
, nexl
. Wei nso kyerɛ sɛ wɔabɔ tier biara bumped up level baako (enti.col-md-6
wɔ v3 mu seesei.col-lg-6
ɛwɔ v4 mu). xs
wɔasesa grid adesua ahorow no sɛnea ɛbɛyɛ a ɛrenhia sɛ infix no gyina hɔ ma pɛpɛɛpɛ sɛ wofi ase de style ahorow di dwuma wɔmin-width: 0
na ɛnyɛ pixel bo a wɔahyɛ no. Sɛ́ anka ɛbɛyɛ.col-xs-6
, ɛyɛ mprempren.col-6
. Grid tiers afoforo nyinaa hwehwɛ infix (sɛ nhwɛso no,sm
).
- Wɔde
- Wɔayɛ grid akɛseɛ, mixins, ne nsakraeɛ foforɔ.
- Grid gutters seesei wɔ Sass map enti wobɛtumi akyerɛ gutter ntrɛmu pɔtee wɔ breakpoint biara.
- Updated grid mixins de utilize a
make-col-ready
prep mixin ne amake-col
de hyehyɛflex
nemax-width
ma ankorankoro column sizing. - Wɔasesa grid system media query breakpoints ne container widths de bu akontaa ma grid tier foforo na hwɛ hu sɛ columns no yɛ pɛpɛɛpɛ divisible denam
12
wɔ wɔn max width. - Mprempren wɔde Sass maps (
$grid-breakpoints
ne$container-max-widths
) di grid breakpoints ne container widths ho dwuma sen sɛ wɔde nsa kakraa bi na ɛyɛ nsakrae ahorow a ɛsono emu biara. Eyinom si@screen-*
nsakrae ahorow no ananmu koraa na ɛma wutumi sesa grid tiers no koraa. - Nsɛm ho amanneɛbɔfo nsɛmmisa nso asesa. Sɛ́ anka yɛbɛsan ayɛ yɛn nsɛm ho amanneɛbɔfo asɛmmisa mpaemuka ahorow a ɛsom bo koro no ara bere biara no, mprempren yɛwɔ
@include media-breakpoint-up/down/only
. Afei, sɛ́ anka wobɛkyerɛw@media (min-width: @screen-sm-min) { ... }
, wubetumi akyerɛw@include media-breakpoint-up(sm) { ... }
.
Nneɛma a ɛwom
- Panel ahorow, mfonini nketewa, ne abura a wɔatow agu ama ade foforo a ɛka biribiara ho, nkrataa .
- Wogyaee Glyphicons ahyɛnsode font no. Sɛ wuhia ahyɛnsode ahorow a, nneɛma bi a wubetumi apaw ne:
- Glyphicons no fã a ɛwɔ soro no
- Octicon ahorow
- Font a Ɛyɛ Hu
- Hwɛ Trɛw mu kratafa no na woahu akwan foforo a wɔbɛfa so ayɛ saa. So wowɔ nyansahyɛ afoforo? Yɛsrɛ sɛ bue asɛm bi anaa PR.
- Wogyaee Affix jQuery plugin no.
- Yɛkamfo kyerɛ sɛ fa di dwuma
position: sticky
mmom. Hwɛ HTML5 Yɛsrɛ wo nkyerɛwde no ma nsɛm no mu nsɛm ne polyfill nyansahyɛ pɔtee. Nyansahyɛ biako ne sɛ wɔde mmara bi@supports
bedi dwuma de adi dwuma (sɛ nhwɛso no,@supports (position: sticky) { ... }
) . - Sɛ na wode Affix redi dwuma de adi dwuma de aka ho, a ɛnyɛ
position
styles a, ebia polyfills no rentumi mmoa wo dwumadie asɛm no. Ade biako a wubetumi afa so de adi dwuma saa ne ScrollPos-Styler nhomakorabea a ɛto so abiɛsa no.
- Yɛkamfo kyerɛ sɛ fa di dwuma
- Droped pager component sɛ ɛyɛ titiriw kakra customized buttons.
- Ɛkame ayɛ sɛ wɔyɛɛ afã horow no nyinaa foforo de dii dwuma de adesuakuw a wɔpaw no a wɔmfa nested pii nni dwuma sen sɛ wɔde mmofra a wɔpaw nneɛma pɔtee dodo bedi dwuma.
Ɛdenam ɔfã bi so
Saa list yi si nsakrae titiriw a ɛwɔ component biara mu wɔ v3.xx ne v4.0.0 ntam no so dua.
Reboot no bio
Foforo wɔ Bootstrap 4 ne Reboot , stylesheet foforo a egyina Normalize so a yɛn ankasa adwene bi wɔ reset styles. Nneɛma a wɔpaw a ɛbɛpue wɔ fael yi mu no de elements nkutoo na edi dwuma—klas biara nni ha. Eyi tew yɛn reset styles fi yɛn component styles ho ma ɛyɛ modular kwan kɛse. Resets a ɛho hia paa a eyi ka ho no bi ne box-sizing: border-box
nsakrae, a ɛkɔ em
units rem
so wɔ elements pii so, link styles, ne form element resets pii.
Typography a wɔde kyerɛw nsɛm
.text-
Wɔde utilities nyinaa kɔɔ_utilities.scss
fael no mu.- Droped
.page-header
sɛ ne styles betumi adi dwuma via utilities. .dl-horizontal
wɔatow agu. Mmom, fa.row
on<dl>
na fa grid column classes (anaa mixins) di dwuma wɔ ne<dt>
ne<dd>
mmofra so.- Wɔasan ayɛ blockquotes, de wɔn styles afi
<blockquote>
element no mu akɔ adesuakuw biako mu,.blockquote
. Wogyaee.blockquote-reverse
modifier no ma text utilities no. .list-inline
afei hwehwɛ sɛ ne mma kyerɛw nneɛma no ma wɔde.list-inline-item
adesuakuw foforo no di dwuma wɔ wɔn ho.
Mfonini ahorow
- Wɔsesaa ne din
.img-responsive
yɛɛ no.img-fluid
. - Wɔsesaa din
.img-rounded
yɛɛ no.rounded
- Wɔsesaa din
.img-circle
yɛɛ no.rounded-circle
Nnwinnade ahorow
- Ɛkame ayɛ sɛ wɔayi
>
selector no nhwɛso nyinaa afi hɔ, a ɛkyerɛ sɛ afei deɛ nested tables bɛnya styles afiri wɔn awofoɔ hɔ ankasa. Eyi ma yɛn selectors ne nea ebetumi ayɛ customizations no yɛ mmerɛw kɛse. - Wɔsesaa din
.table-condensed
yɛɛ no sɛnea.table-sm
ɛbɛyɛ a ɛbɛkɔ so pɛpɛɛpɛ. - Wɔde ɔkwan foforo
.table-inverse
a wobetumi afa so aka ho. - Wɔde table header nsakrae ahorow aka ho:
.thead-default
ne.thead-inverse
. - Wɔasesa nsɛm a ɛfa ho adesua ahorow din sɛnea ɛbɛyɛ a wobenya
.table-
-prefix. Enti.active
,.success
,.warning
,.danger
ne.info
to.table-active
,.table-success
,.table-warning
,.table-danger
ne.table-info
.
Nkyerɛwee ahorow
- Element a wɔatu no san kɔ
_reboot.scss
fael no so. - Wɔsesaa ne din
.control-label
yɛɛ no.col-form-label
. - Wɔasesa din
.input-lg
ne.input-sm
to.form-control-lg
ne.form-control-sm
, sɛnea ɛte biara. - Wogyaee
.form-group-*
adesua ahorow esiane sɛ ɛbɛyɛ mmerɛw nti. Fa.form-control-*
adesua ahorow di dwuma mmom mprempren. - Tow
.help-block
na wɔde.form-text
for block-level help text sii ananmu. Sɛ wopɛ inline mmoa nsɛm ne akwan foforo a ɛyɛ mmerɛw a wobɛpaw a, fa mfaso adesua ahorow te sɛ.text-muted
. - Wɔtow gui
.radio-inline
na.checkbox-inline
. - Consolidated
.checkbox
ne.radio
mu.form-check
ne.form-check-*
adesuakuw ahorow no. - Horizontal forms a wɔayɛ no foforo:
- Wogyaee
.form-horizontal
adesuakuw no ahwehwɛde no. .form-group
mfa styles a ɛfiri.row
via mixin no mu nni dwuma bio, enti.row
seesei ɛho hia ma horizontal grid layouts (sɛ nhwɛsoɔ no,<div class="form-group row">
).- Wɔde
.col-form-label
adesuakuw foforo aka vertically center labels a.form-control
s wom no ho. - Wɔde foforo aka ho
.form-row
ama compact form layouts ne grid classes (swap wo.row
for a.form-row
na kɔ).
- Wogyaee
- Wɔde custom forms mmoa aka ho (ma checkboxes, radios, selects, ne file inputs).
- Wɔde HTML5 fom validation a ɛnam CSS's ne pseudo-classes so asi
.has-error
,.has-warning
, ne adesua ahorow ananmu..has-success
:invalid
:valid
- Wɔsesaa ne din
.form-control-static
yɛɛ no.form-control-plaintext
.
Nsɛmma nhoma no
- Wɔsesaa ne din
.btn-default
yɛɛ no.btn-secondary
. - Droped
.btn-xs
adesuakuw no koraa sɛnea.btn-sm
ɛyɛ proportionally pii ketewaa sen v3's. - Wɔagyae jQuery plugin no stateful button afã no .
button.js
Nea ɛka eyi ho$().button(string)
ne$().button('reset')
akwan a wɔfa so yɛ no. Yɛtu fo sɛ fa JavaScript ketewaa bi a wɔahyɛ da ayɛ mmom di dwuma, a ɛbɛma woanya mfaso sɛ wobɛyɛ w’ade sɛnea wopɛ no pɛpɛɛpɛ.- Hyɛ no nsow sɛ wɔakora plugin no mu nneɛma afoforo (button checkboxes, button radios, single-toggle buttons) so wɔ v4 mu.
- Sesa buttons'
[disabled]
kɔ:disabled
sɛnea IE9 + boa:disabled
. Nansofieldset[disabled]
ɛda so ara hia efisɛ native disabled fieldsets da so ara yɛ buggy wɔ IE11 mu.
Button kuw no
- San kyerɛw component ne flexbox.
- Wɔayi afi
.btn-group-justified
hɔ . Sɛ́ nea wode besi ananmu no wubetumi de adi dwuma<div class="btn-group d-flex" role="group"></div>
sɛ ade a wɔde kyekyere nneɛma ho a ɛwɔ.w-100
. - Wogyaee
.btn-group-xs
adesuakuw no koraa a wɔde yii.btn-xs
. - Wɔayi kwan a ɛda bɔtn akuw ntam a ɛda adi pefee wɔ bɔtn adwinnade ahorow mu no afi hɔ; fa margin utilities di dwuma mprempren.
- Nwoma a wɔatu mpɔn a wɔde bedi dwuma wɔ nneɛma afoforo ho.
Nneɛma a wɔde gu fam
- Wɔasesae fi awofo a wɔpaw no so kɔɔ adesuakuw biako so ma nneɛma a ɛwom nyinaa, nsakraefo, ne nea ɛkeka ho.
- Dropdown styles a wɔayɛ no mmerɛw sɛ wɔremfa nkɔma bio a agyan a ɛhwɛ soro anaa fam a wɔde abata dropdown menu no ho.
- Wobetumi de
<div>
s anaa<ul>
s akyekye dropdowns mprempren. - Wɔasan asi dropdown styles ne markup de ama mmoa a ɛnyɛ den, a wɔasisi mu ama
<a>
na<button>
egyina dropdown nneɛma so. - Wɔsesaa ne din
.divider
yɛɛ no.dropdown-divider
. - Mprempren nneɛma a wɔde bɛto fam no hwehwɛ sɛ
.dropdown-item
. - Dropdown toggles nhia bio sɛ wɔde explicit
<span class="caret"></span>
; mprempren wɔde eyi ama ankasa denam CSS's::after
on.dropdown-toggle
.
Grid nhyehyɛe
- Wɔde
576px
grid breakpoint foforo aka ho sɛsm
, a ɛkyerɛ sɛ mprempren ɛwɔ tiers anum a wɔaka abom (xs
,sm
,md
,lg
, nexl
). - Wɔsesaa grid modifier adesua ahorow a ɛyɛ mmuae no din fii
.col-{breakpoint}-{modifier}-{size}
to so.{modifier}-{breakpoint}-{size}
maa grid adesua ahorow a ɛyɛ mmerɛw. - Wogyaee push ne pull modifier adesua ahorow no maa adesuakuw foforo a wɔde flexbox-powered
order
di dwuma no. Sɛ nhwɛso no, sɛ́ anka wode.col-8.push-4
ne.col-4.pull-8
bedi dwuma no, anka wode.col-8.order-2
ne bedi dwuma.col-4.order-1
. - Wɔde flexbox utility adesua ahorow aka ho ama grid nhyehyɛe ne nneɛma a ɛwom.
Kyerɛw akuw ahorow din
- San kyerɛw component ne flexbox.
- Wɔde
a.list-group-item
adesuakuw a ɛda adi pefee asi ananmu,.list-group-item-action
, ama styling link ne button nkyerɛase ahorow a ɛwɔ list kuw nneɛma mu. - Wɔde
.list-group-flush
adesuakuw bi aka ho a wɔde bedi dwuma wɔ nkrataa ho.
Modal a wɔde di dwuma
- San kyerɛw component ne flexbox.
- Sɛ yɛde tu kɔ flexbox no ma a, ɛbɛyɛ sɛ alignment of dismiss icons wɔ header no mu no asɛe efisɛ yɛmfa floats nni dwuma bio. Floated content na edi kan, nanso flexbox ho no ɛnyɛ saa bio. Update wo dismiss icons sɛ ɛbɛba akyi modal titles na woasiesie.
- Woyii
remote
ɔkwan a wɔfa so paw (a wobetumi de adi dwuma de ahyɛ akyi nneɛma na wɔde ahyɛ modal mu) neloaded.bs.modal
adeyɛ a ɛne no hyia no fii hɔ. Yɛhyɛ nyansa mmom sɛ fa client-side templating anaa data binding framework di dwuma, anaasɛ frɛ jQuery.load w’ankasa.
Navs
- San kyerɛw component ne flexbox.
- Ɛkame ayɛ sɛ wɔde
>
selectors nyinaa too fam maa styling a ɛyɛ mmerɛw via un-nested classes. - Sɛ anka yɛde HTML-specific selectors te sɛ
.nav > li > a
, yɛde adesua ahorow a ɛsono emu biara di dwuma ma.nav
s, ..nav-item
s, ne.nav-link
s. Wei ma wo HTML no yɛ mmerɛw bere a ɛde ntrɛwmu a ɛkɔ soro ba no.
Navbar na ɛwɔ hɔ
Wɔasan akyerɛw navbar no koraa wɔ flexbox mu a ɛwɔ mmoa a ɛkɔ anim ma alignment, mmuae, ne customization.
- Mprempren wɔde navbar nneyɛe a ɛma mmuae di dwuma wɔ
.navbar
adesuakuw no mu denam nea wɔhwehwɛ no so.navbar-expand-{breakpoint}
a ɛwɔ baabi a wobɛpaw baabi a wobɛbu navbar no. Kane no na eyi yɛ Less variable nsakrae na na ɛhwehwɛ sɛ wɔsan boaboa ano. .navbar-default
is now.navbar-light
, ɛwom sɛ.navbar-dark
ɛda so ara yɛ nea ɛte saa ara de. Eyinom mu biako na wɔhwehwɛ wɔ navbar biara so. Nanso, saa adesuakuw ahorow yi nhyehyɛ biobackground-color
; mmom no, nea ɛho hia no, ɛkacolor
.- Navbars mprempren hwehwɛ sɛ wɔyɛ akyi mpaemuka bi. Paw fi yɛn akyi utilities (
.bg-*
) anaa hyehyɛ w’ankasa de ne hann/inverse adesua ahorow a ɛwɔ atifi hɔ no ma mad customization . - Wɔde flexbox styles ama no, afei navbars betumi de flexbox utilities adi dwuma ama alignment options a ɛnyɛ den.
.navbar-toggle
yɛ mprempren.navbar-toggler
na ɛwɔ style ahorow ne emu markup (ɛnyɛ<span>
s abiɛsa bio).- Wogyaee
.navbar-form
adesua no koraa. Ɛho nhia bio; mmom no,.form-inline
fa margin utilities di dwuma kɛkɛ na fa di dwuma sɛnea ɛho hia. - Navbars no nka ho bio
margin-bottom
anaasɛborder-radius
default so. Fa utilities di dwuma sɛnea ɛho hia. - Wɔayɛ nhwɛsoɔ a ɛkyerɛ navbars nyinaa foforɔ ama wɔde markup foforɔ ahyɛ mu.
Nkratafa a wɔde kyerɛw nsɛm
- San kyerɛw component ne flexbox.
- Mprempren wɔhwehwɛ sɛ wɔde adesua ahorow a ɛda adi pefee (
.page-item
,.page-link
) di dwuma wɔ asefo a wɔwɔ hɔ no so.pagination
) wɔ s - Droped
.pager
component no koraa sɛnea na ɛyɛ kakraa bi sen customized outline buttons.
Abodoo a wɔayam
- Mprempren wɔhwehwɛ adesuakuw a ɛda adi pefee, , wɔ s
.breadcrumb-item
asefo so.breadcrumb
Nkyerɛwde ne badge ahorow
- Wɔahyɛ
.label
no den na.badge
wɔatew mu afi<label>
element no ho na wɔama nneɛma a ɛfa ho no ayɛ mmerɛw. - Wɔde kaa ho
.badge-pill
sɛ modifier ma kurukuruwa “pill” hwɛ. - Badge ahorow no ntumi nkɔ soro bio wɔ list akuw ne nneɛma afoforo mu. Mprempren wɔhwehwɛ sɛ wɔyɛ utility adesua ahorow ma ɛno.
.badge-default
wɔatow agu na.badge-secondary
wɔde aka ho ma ɛne component modifier class ahorow a wɔde di dwuma wɔ mmeae afoforo no ahyia.
Panel ahorow, mfonini nketewa, ne abura ahorow
Wɔagyae koraa ama kaad no fã foforo no.
Panel ahorow
.panel
to.card
, mprempren wɔde flexbox na ɛyɛe..panel-default
wɔayi afi hɔ na wɔamfa nsi ananmu..panel-group
wɔayi afi hɔ na wɔamfa nsi ananmu..card-group
nyɛ ade a wɔde besi ananmu, ɛyɛ soronko..panel-heading
kɔ.card-header
.panel-title
to.card-title
. Ɛgyina sɛnea wopɛ sɛ wohwɛ no so no, wubetumi nso de asɛmti mu nneɛma anaa adesua ahorow (sɛ nhwɛso<h3>
no ,.h3
) anaasɛ nneɛma anaa adesua ahorow a ɛyɛ tuntum (sɛ nhwɛso<strong>
no ,<b>
,.font-weight-bold
) di dwuma. Hyɛ no nsow sɛ.card-title
, ɛwom sɛ wɔato din saa ara de, nanso ɛma ɛyɛ soronko sen.panel-title
..panel-body
kɔ.card-body
.panel-footer
kɔ.card-footer
.panel-primary
,.panel-success
,.panel-info
,.panel-warning
, na.panel-danger
wɔatow agu ama.bg-
,.text-
, ne.border
utilities a wɔayɛ afi yɛn$theme-colors
Sass map no mu.
Mpuntuo
- Wɔde utilities sii nsɛm a ɛfa ho
.progress-bar-*
adesua ahorow ananmu.bg-*
. Sɛ nhwɛso no,class="progress-bar progress-bar-danger"
ɛbɛyɛclass="progress-bar bg-danger"
. - Wɔde .
.active
_.progress-bar-animated
Carousel a wɔde yɛ nneɛma
- Wɔyɛɛ ɔfã no nyinaa foforo sɛnea ɛbɛyɛ a ɛbɛyɛ mmerɛw sɛ wɔbɛyɛ ne sɛnea wɔyɛ no. Yɛwɔ styles kakraa bi a wobɛtumi abɔ so, nsɛnkyerɛnneɛ foforɔ, ne ahyɛnsodeɛ foforɔ.
- Wɔayi CSS nyinaa afiri mu na wɔasesa din, ahwɛ ahu sɛ wɔde
.carousel-
.- Wɔ carousel nneɛma ho no,
.next
,.prev
,.left
, ne.right
mprempren.carousel-item-next
,.carousel-item-prev
,.carousel-item-left
, ne.carousel-item-right
. .item
nso yɛ mprempren.carousel-item
.- Wɔ prev/next controls,
.carousel-control.right
na.carousel-control.left
ɛyɛ seesei.carousel-control-next
ne.carousel-control-prev
, a ɛkyerɛ sɛ wɔnhia base class pɔtee bi bio.
- Wɔ carousel nneɛma ho no,
- Woyii mmuaeɛ styling nyinaa, deferring to utilities (sɛ nhwɛsoɔ, kyerɛ captions wɔ viewports binom so) ne custom styles sɛdeɛ ɛhia.
- Wɔayi mfonini overrides ama mfonini ahorow wɔ carousel nneɛma mu, deferring to utilities.
- Tweaked Carousel nhwɛso no de markup foforo ne styles no aka ho.
Nnwinnade ahorow
- Wɔayi mmoa a wɔde ma styled nested tables no afi hɔ. Seesei wɔagye table styles nyinaa wɔ v4 mu ama selectors a ɛnyɛ den.
- Wɔde inverse table variant kaa ho.
Nneɛma a wɔde di dwuma
- Yi adi, nea wɔde asie, ne nea ɛkeka ho:
- Ɔmaa ɔyɛkyerɛ utilities yɛɛ adwuma (sɛ nhwɛso no,
.d-none
ned-{sm,md,lg,xl}-none
). - Wogyaee utilities dodow no ara ma display utilities
.hidden-*
foforo . Sɛ nhwɛso no, sɛ́ anka wode bedi dwuma no , fa . Wɔasesa utilities no din de adi dwuma de display utility din nhyehyɛe no adi dwuma. More info wɔ Responsive utilities ɔfã a ɛwɔ krataafa yi ase no ase..hidden-sm-up
.d-sm-none
.hidden-print
- Added
.float-{sm,md,lg,xl}-{left,right,none}
classes for responsive floats na woyii.pull-left
na.pull-right
esiane sɛ wɔyɛ redundant to.float-left
ne.float-right
.
- Ɔmaa ɔyɛkyerɛ utilities yɛɛ adwuma (sɛ nhwɛso no,
- Korɔ:
- Wɔde nsakrae a ɛma mmuae kaa yɛn nsɛm a wɔde hyehyɛ adesua ahorow
.text-{sm,md,lg,xl}-{left,center,right}
no ho .
- Wɔde nsakrae a ɛma mmuae kaa yɛn nsɛm a wɔde hyehyɛ adesua ahorow
- Nhyiam ne ntam kwan:
- Wɔde mmuae foforo margin ne padding utilities kaa ho ma afã horow nyinaa, ne vertical ne horizontal shorthands.
- Wɔde boatload a ɛyɛ flexbox utilities kaa ho .
- Wɔde too hɔ maa adesuakuw
.center-block
foforo no..mx-auto
- Clearfix ayɛ foforo sɛ ɛbɛgyae mmoa a wɔde ma browser nkyerɛase dedaw no.
Vendor anim asɛm mixins
Bootstrap 3 no vendor prefix mixins, a na wɔagyae wɔ v3.2.0 mu no, wɔayi afi hɔ wɔ Bootstrap 4. Esiane sɛ yɛde Autoprefixer di dwuma nti , ɛho nhia bio.
Woyii mixins a edidi so yi fii hɔ : animation
, animation-delay
, animation-direction
, animation-duration
, animation-fill-mode
, animation-iteration-count
, animation-name
, animation-timing-function
, backface-visibility
, box-sizing
, content-columns
, hyphens
, opacity
, perspective
, perspective-origin
, rotate
, rotateX
, rotateY
, scale
, scaleX
, scaleY
, skew
, transform-origin
, transition-delay
, transition-duration
,transition-property
transition-timing-function
transition-transform
translate
translate3d
user-select
Nwoma a Wɔkyerɛwee
Yɛn nkrataa no nyaa nkɔso wɔ board no nyinaa so nso. Ɛha na ɛba fam no:
- Yɛda so ara de Jekyll redi dwuma, nanso yɛwɔ plugins wɔ mix no mu:
bugify.rb
no yɛ nea wɔde kyerɛw nsɛm a ɛwɔ yɛn browser bugs krataafa no so no yiye.example.rb
yɛ custom fork a ɛwɔ defaulthighlight.rb
plugin no mu, a ɛma kwan ma ɛyɛ mmerɛw sɛ wobedi nhwɛso-kode ho dwuma.callout.rb
yɛ amanne fork a ɛte saa ara a ɛte saa, nanso wɔayɛ ama yɛn docs callouts soronko no.- jekyll-toc na wɔde yɛ yɛn table of contents no.
- Wɔasan akyerɛw docs mu nsɛm nyinaa wɔ Markdown mu (sen sɛ wɔbɛkyerɛw HTML) ama ayɛ mmerɛw sɛ wɔbɛsesa.
- Wɔasan asiesie nkratafa no ama nsɛm a ɛyɛ mmerɛw ne nhyehyɛe a ɛyɛ mmerɛw sɛ wɔbɛbɛn no.
- Yɛfirii CSS a ɛyɛ daa so kɔɔ SCSS so sɛ yɛrekɔfa Bootstrap no nsakraeɛ, mixins, ne nea ɛkeka ho no so mfasoɔ koraa.
Nneɛma a wɔde di dwuma a ɛyɛ mmuae
Wɔayi @screen-
nsakraeɛ nyinaa afiri hɔ wɔ v4.0.0 mu. Fa media-breakpoint-up()
, media-breakpoint-down()
, anaa media-breakpoint-only()
Sass mixins anaa $grid-breakpoints
Sass map no di dwuma mmom.
Wɔayi yɛn utility adesua ahorow a ɛyɛ mmuae no afi hɔ kɛse de agye utility ahorow a ɛda adi pefee no atom display
.
- Wɔayi
.hidden
ne.show
adesua ahorow no afi hɔ efisɛ ɛne jQuery's$(...).hide()
ne$(...).show()
akwan horow no bɔ abira. Mmom, bɔ mmɔden sɛ wobɛdannan[hidden]
su no anaa fa inline styles te sɛstyle="display: none;"
nestyle="display: block;"
. - Wɔayi
.hidden-
adesua ahorow nyinaa afi hɔ, gye print utilities a wɔasesa din no.- Wɔayi afi v3 mu:
.hidden-xs
.hidden-sm
.hidden-md
.hidden-lg
.visible-xs-block
.visible-xs-inline
.visible-xs-inline-block
.visible-sm-block
.visible-sm-inline
.visible-sm-inline-block
.visible-md-block
.visible-md-inline
.visible-md-inline-block
.visible-lg-block
.visible-lg-inline
.visible-lg-inline-block
- Wɔayi afi v4 alphas mu:
.hidden-xs-up
.hidden-xs-down
.hidden-sm-up
.hidden-sm-down
.hidden-md-up
.hidden-md-down
.hidden-lg-up
.hidden-lg-down
- Wɔayi afi v3 mu:
- Print utilities no mfi ase bio wɔ
.hidden-
anaa.visible-
, na mmom.d-print-
.- Edin dedaw:
.visible-print-block
,.visible-print-inline
,.visible-print-inline-block
, ..hidden-print
- Adesua foforo:
.d-print-block
,.d-print-inline
,.d-print-inline-block
, ..d-print-none
- Edin dedaw:
Sɛ́ anka wode .visible-*
adesua ahorow a ɛda adi pefee bedi dwuma no, woma element bi da adi denam nea woremfa nsie wɔ saa screen kɛse no so ara kwa no so. Wubetumi de .d-*-none
adesuakuw biako ne adesuakuw biako aka abom .d-*-block
de akyerɛ element bi wɔ ntamgyinafo bi a wɔde ama a ɛwɔ screen akɛse nkutoo so (sɛ nhwɛso no, .d-none.d-md-block.d-xl-none
ɛkyerɛ element no wɔ mfiri a ɛwɔ mfinimfini ne akɛse nkutoo so).
Hyɛ no nsow sɛ nsakrae a ɛba wɔ grid breakpoints mu wɔ v4 mu no kyerɛ sɛ ɛho behia sɛ wokɔ breakpoint biako kɛse na ama woanya aba koro no ara. Mmuaeɛ utility adesua foforɔ no mmɔ mmɔden sɛ ɛbɛgye nsɛm a ɛntaa nsi a element bi a wɔhunu no ntumi nkyerɛ sɛ viewport akɛseɛ ahodoɔ baako a ɛtoatoa soɔ; ɛho behia mmom sɛ wode custom CSS di dwuma wɔ nsɛm a ɛtete saa mu.