Mipata
Bootstrap imaphatikizapo magawo angapo omvera amfupi komanso makalasi othandizira kuti asinthe mawonekedwe a chinthu.
Momwe zimagwirira ntchito
Perekani zovomerezeka margin
kapena padding
zofunikira ku chinthu kapena kagawo kakang'ono ka mbali zake ndi makalasi achidule. Zimaphatikizapo chithandizo cha katundu aliyense payekha, katundu yense, ndi zowoneka ndi zopingasa. Maphunziro amapangidwa kuchokera pamapu okhazikika a Sass kuyambira .25rem
mpaka 3rem
.
Kuzindikira
Zida zopangira masitayilo zomwe zimagwira ntchito pama breakpoints onse, kuyambira xs
mpaka xl
, zilibe chidule cha breakpoint mwa iwo. Izi ndichifukwa choti makalasiwo amagwiritsidwa ntchito kuchokera min-width: 0
ndi mmwamba, motero samamangidwa ndi funso lazama media. Zotsalira zotsalira, komabe, zikuphatikiza chidule cha breakpoint.
Maphunzirowa amatchulidwa pogwiritsa ntchito mawonekedwe {property}{sides}-{size}
a xs
, , , ndi .{property}{sides}-{breakpoint}-{size}
sm
md
lg
xl
Kumene katundu ndi imodzi mwa:
m
- kwa makalasi omwe akhazikitsidwamargin
p
- kwa makalasi omwe akhazikitsidwapadding
Kumene mbali ndi imodzi mwa:
t
- kwa makalasi omwe amakhazikitsamargin-top
kapenapadding-top
b
- kwa makalasi omwe amakhazikitsamargin-bottom
kapenapadding-bottom
l
- kwa makalasi omwe amakhazikitsamargin-left
kapenapadding-left
r
- kwa makalasi omwe amakhazikitsamargin-right
kapenapadding-right
x
- kwa makalasi omwe amakhazikitsa onse*-left
ndi*-right
y
- kwa makalasi omwe amakhazikitsa onse*-top
ndi*-bottom
- opanda kanthu - m'makalasi omwe amayika mbali
margin
zonsepadding
zinayi za chinthucho
Kumene kukula ndi chimodzi mwa:
0
- m'makalasi omwe amachotsamargin
kapenapadding
kuyiyika0
1
- (mwachisawawa) pamakalasi omwe amakhazikitsamargin
kapenapadding
ku$spacer * .25
2
- (mwachisawawa) pamakalasi omwe amakhazikitsamargin
kapenapadding
ku$spacer * .5
3
- (mwachisawawa) pamakalasi omwe amakhazikitsamargin
kapenapadding
ku$spacer
4
- (mwachisawawa) pamakalasi omwe amakhazikitsamargin
kapenapadding
ku$spacer * 1.5
5
- (mwachisawawa) pamakalasi omwe amakhazikitsamargin
kapenapadding
ku$spacer * 3
auto
- pamakalasi omwe amakhazikitsamargin
auto
(Mutha kuwonjezera kukula kwake powonjezera zolemba $spacers
pamapu a Sass.)
Zitsanzo
Nazi zitsanzo zoimira makalasi awa:
.mt-0 {
margin-top: 0 !important;
}
.ml-1 {
margin-left: ($spacer * .25) !important;
}
.px-2 {
padding-left: ($spacer * .5) !important;
padding-right: ($spacer * .5) !important;
}
.p-3 {
padding: $spacer !important;
}
Chopingasa pakati
Kuphatikiza apo, Bootstrap imaphatikizansopo .mx-auto
kalasi yokhazikika yopingasa mulingo wa block - ndiye kuti, zomwe zili display: block
ndi width
seti - pokhazikitsa malire opingasa mpaka auto
.
<div class="mx-auto" style="width: 200px;">
Centered element
</div>
Mtsinje wopanda pake
Mu CSS, margin
katundu amatha kugwiritsa ntchito zinthu zolakwika ( padding
sangathe). Pofika pa 4.2, tawonjeza zosokoneza pamtundu uliwonse wopanda ziro womwe watchulidwa pamwambapa (mwachitsanzo, 1
, 2
, 3
, 4
, 5
). Zothandizira izi ndizoyenera kusintha ma grid column gutters kudutsa ma breakpoints.
Mawuwo ali pafupifupi ofanana ndi osasinthika, abwino am'mphepete mwazinthu zofunikira, koma ndikuwonjezera n
kukula kwake komwe kusanachitike. Nayi kalasi yachitsanzo yomwe ili yosiyana ndi .mt-1
:
.mt-n1 {
margin-top: -0.25rem !important;
}
Nachi chitsanzo chakusintha grid ya Bootstrap pakatikati ( md
) breakpoint ndi pamwambapa. Tawonjeza .col
padding ndi .px-md-5
kenako kutsutsana ndi .mx-md-n5
pa kholo .row
.
<div class="row mx-md-n5">
<div class="col px-md-5"><div class="p-3 border bg-light">Custom column padding</div></div>
<div class="col px-md-5"><div class="p-3 border bg-light">Custom column padding</div></div>
</div>