Kujambula
Zolemba ndi zitsanzo za kalembedwe ka Bootstrap, kuphatikiza zosintha zapadziko lonse lapansi, mitu, zolemba zathupi, mindandanda, ndi zina zambiri.
Zokonda padziko lonse lapansi
Bootstrap imayika mawonedwe oyambira padziko lonse lapansi, typography, ndi masitayilo a ulalo. Mukafunika kuwongolera kwambiri, yang'anani makalasi ogwiritsira ntchito malemba .
- Gwiritsani ntchito masanjidwe amtundu omwe amasankha zabwino
font-family
kwambiri pa OS ndi chipangizo chilichonse. - Kuti tipeze mitundu yambiri yophatikizika komanso yofikirika, timagwiritsa ntchito mizu yosasinthika ya
font-size
asakatuli (yomwe nthawi zambiri imakhala 16px) kuti alendo azitha kusintha makonda awo asakatuli momwe angafunikire. - Gwiritsani ntchito
$font-family-base
,$font-size-base
, ndi mawonekedwe$line-height-base
monga maziko athu a typographic akugwiritsidwa ntchito ku<body>
. - Khazikitsani mtundu wa ulalo wapadziko lonse lapansi kudzera pa
$link-color
. - Gwiritsani
$body-bg
ntchito kukhazikitsa abackground-color
pa<body>
(#fff
mwachisawawa).
Masitayilo awa atha kupezeka mkati _reboot.scss
, ndipo zosintha zapadziko lonse lapansi zimatanthauzidwa mu _variables.scss
. Onetsetsani kuti $font-size-base
mwalowa rem
.
Mitu
Mitu yonse ya HTML, <h1>
kupyolera mu <h6>
, ilipo.
Mutu | Chitsanzo |
---|---|
<h1></h1> |
h1 ndi. Mutu wa bootstrap |
<h2></h2> |
h2 ndi. Mutu wa bootstrap |
<h3></h3> |
h3 ndi. Mutu wa bootstrap |
<h4></h4> |
h4 ndi. Mutu wa bootstrap |
<h5></h5> |
h5 ndi. Mutu wa bootstrap |
<h6></h6> |
h6 ndi. Mutu wa bootstrap |
<h1>h1. Bootstrap heading</h1>
<h2>h2. Bootstrap heading</h2>
<h3>h3. Bootstrap heading</h3>
<h4>h4. Bootstrap heading</h4>
<h5>h5. Bootstrap heading</h5>
<h6>h6. Bootstrap heading</h6>
.h1
kudzera .h6
m'makalasi amapezekanso, chifukwa mukafuna kufananiza masitayilo amutu koma osagwiritsa ntchito chinthu chogwirizana ndi HTML.
h1 ndi. Mutu wa bootstrap
h2 ndi. Mutu wa bootstrap
h3 ndi. Mutu wa bootstrap
h4 ndi. Mutu wa bootstrap
h5 ndi. Mutu wa bootstrap
h6 ndi. Mutu wa bootstrap
<p class="h1">h1. Bootstrap heading</p>
<p class="h2">h2. Bootstrap heading</p>
<p class="h3">h3. Bootstrap heading</p>
<p class="h4">h4. Bootstrap heading</p>
<p class="h5">h5. Bootstrap heading</p>
<p class="h6">h6. Bootstrap heading</p>
Kusintha mitu
Gwiritsani ntchito makalasi ophatikizidwa kuti mulembenso mutu wawung'ono wachiwiri kuchokera ku Bootstrap 3.
Mutu wowoneka bwino Wokhala ndi mawu achiwiri ozimiririka
<h3>
Fancy display heading
<small class="text-muted">With faded secondary text</small>
</h3>
Onetsani mitu
Mitu yachikhalidwe idapangidwa kuti izigwira bwino ntchito patsamba lanu. Mukafuna mutu kuti muwoneke bwino, ganizirani kugwiritsa ntchito mutu wowonetsera - wokulirapo, wamutu wamutu wokulirapo pang'ono.
<h1 class="display-1">Display 1</h1>
<h1 class="display-2">Display 2</h1>
<h1 class="display-3">Display 3</h1>
<h1 class="display-4">Display 4</h1>
<h1 class="display-5">Display 5</h1>
<h1 class="display-6">Display 6</h1>
Mitu yowonetsera imakonzedwa kudzera pa $display-font-sizes
mapu a Sass ndi mitundu iwiri, $display-font-weight
ndi $display-line-height
.
$display-font-sizes: (
1: 5rem,
2: 4.5rem,
3: 4rem,
4: 3.5rem,
5: 3rem,
6: 2.5rem
);
$display-font-weight: 300;
$display-line-height: $headings-line-height;
Kutsogolera
Pangani ndime kukhala yodziwika bwino powonjezera .lead
.
Iyi ndi ndime yotsogolera. Imasiyana ndi ndime zanthawi zonse.
<p class="lead">
This is a lead paragraph. It stands out from regular paragraphs.
</p>
Zolemba zapaintaneti
Kukongoletsedwa kwazinthu zodziwika bwino za HTML5.
Mutha kugwiritsa ntchito chizindikirocho kutiwunikiranimawu.
Mzerewu walemba uyenera kutengedwa ngati malemba ochotsedwa.
Mzerewu uyenera kuwonedwa ngati wosalondola.
Mzerewu walemba uyenera kutengedwa ngati chowonjezera pa chikalatacho.
Mzere wa mawuwa uwonetsa ngati watsindikira.
Mzere wa mawu awa akuyenera kuwonedwa ngati kusindikizidwa bwino.
Mzerewu wamasuliridwa ngati mawu akuda kwambiri.
Mzerewu wamasuliridwa ngati mawu opendekera.
<p>You can use the mark tag to <mark>highlight</mark> text.</p>
<p><del>This line of text is meant to be treated as deleted text.</del></p>
<p><s>This line of text is meant to be treated as no longer accurate.</s></p>
<p><ins>This line of text is meant to be treated as an addition to the document.</ins></p>
<p><u>This line of text will render as underlined.</u></p>
<p><small>This line of text is meant to be treated as fine print.</small></p>
<p><strong>This line rendered as bold text.</strong></p>
<p><em>This line rendered as italicized text.</em></p>
Chenjerani kuti ma tagwa akuyenera kugwiritsidwa ntchito pazolinga za semantic:
<mark>
imayimira mawu omwe ayikidwa chizindikiro kapena kuwunikira kuti afotokozere kapena kulemba.<small>
imayimira ndemanga zam'mbali ndi zolembedwa zazing'ono, monga kukopera ndi zolemba zamalamulo.<s>
imayimira zinthu zomwe sizilinso zofunika kapena zosalondola.<u>
imayimira kutalika kwa mawu apamzere omwe ayenera kumasuliridwa m'njira yosonyeza kuti ali ndi mawu osagwirizana ndi malemba.
Ngati mukufuna kusintha mawu anu, muyenera kugwiritsa ntchito makalasi otsatirawa m'malo mwake:
.mark
adzagwiritsa ntchito masitayelo ofanana ndi<mark>
..small
adzagwiritsa ntchito masitayelo ofanana ndi<small>
..text-decoration-underline
adzagwiritsa ntchito masitayelo ofanana ndi<u>
..text-decoration-line-through
adzagwiritsa ntchito masitayelo ofanana ndi<s>
.
Ngakhale sizinawonetsedwe pamwambapa, omasuka kugwiritsa ntchito <b>
komanso <i>
mu HTML5. <b>
cholinga chake ndi kuwunikira mawu kapena ziganizo popanda kupereka zofunikira zowonjezera, pomwe <i>
nthawi zambiri zimakhala za mawu, mawu aukadaulo, ndi zina zambiri.
Zothandizira zolemba
Sinthani kamvekedwe ka mawu, kusintha, kalembedwe, kulemera, kutalika kwa mzere, kukongoletsa ndi mtundu ndi zida zathu zamawu ndi utoto .
Chidule cha mawu
Kukhazikitsa kosinthika kwa chinthu cha HTML <abbr>
chofupikitsa ndi ma acronyms kuti awonetse mtundu wokulitsidwa pa hover. Mafupipafupi amakhala ndi mzere wokhazikika ndipo amapeza cholozera chothandizira kuti apereke zina zowonjezera pa hover ndi kwa ogwiritsa ntchito matekinoloje othandizira.
Onjezani .initialism
ku chidule cha kukula kwa mawonekedwe ang'onoang'ono.
attr
HTML
<p><abbr title="attribute">attr</abbr></p>
<p><abbr title="HyperText Markup Language" class="initialism">HTML</abbr></p>
Zolemba za block
Kuti mugwire mawu midadada kuchokera kugwero lina mkati mwazolemba zanu. Mangirirani HTML<blockquote class="blockquote">
iliyonse ngati mawu.
Mawu odziwika bwino, omwe ali mu blockquote element.
<blockquote class="blockquote">
<p>A well-known quote, contained in a blockquote element.</p>
</blockquote>
Kutchula gwero
Zolemba za HTML zimafuna kuti mawonekedwe a blockquote ayikidwe kunja kwa <blockquote>
. Mukamapereka chidziwitso, sungani <blockquote>
mu a <figure>
ndikugwiritsa ntchito gawo <figcaption>
kapena block level (mwachitsanzo, <p>
) ndi .blockquote-footer
kalasi. Onetsetsani kukulunga dzina la gwero ntchito <cite>
komanso.
<figure>
<blockquote class="blockquote">
<p>A well-known quote, contained in a blockquote element.</p>
</blockquote>
<figcaption class="blockquote-footer">
Someone famous in <cite title="Source Title">Source Title</cite>
</figcaption>
</figure>
Kuyanjanitsa
Gwiritsani ntchito zolembera ngati pakufunika kusintha kusintha kwa blockquote yanu.
<figure class="text-center">
<blockquote class="blockquote">
<p>A well-known quote, contained in a blockquote element.</p>
</blockquote>
<figcaption class="blockquote-footer">
Someone famous in <cite title="Source Title">Source Title</cite>
</figcaption>
</figure>
<figure class="text-end">
<blockquote class="blockquote">
<p>A well-known quote, contained in a blockquote element.</p>
</blockquote>
<figcaption class="blockquote-footer">
Someone famous in <cite title="Source Title">Source Title</cite>
</figcaption>
</figure>
Mndandanda
Osatchulidwa
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.
- Uwu ndi mndandanda.
- Zikuoneka kuti sizinalembedwe.
- Mwamadongosolo, akadali mndandanda.
- Komabe, kalembedwe kameneka kamangokhudza zinthu zomwe zangochitika kumene za mwana.
- Minda yosungidwa:
- osakhudzidwa ndi sitayilo iyi
- adzawonetsabe chipolopolo
- ndi kukhala ndi malire oyenera kumanzere
- Izi zitha kukhala zothandiza nthawi zina.
<ul class="list-unstyled">
<li>This is a list.</li>
<li>It appears completely unstyled.</li>
<li>Structurally, it's still a list.</li>
<li>However, this style only applies to immediate child elements.</li>
<li>Nested lists:
<ul>
<li>are unaffected by this style</li>
<li>will still show a bullet</li>
<li>and have appropriate left margin</li>
</ul>
</li>
<li>This may still come in handy in some situations.</li>
</ul>
Motsatana
Chotsani zipolopolo za mndandanda ndikuyika kuwala margin
kophatikiza magulu awiri, .list-inline
ndi .list-inline-item
.
- Ichi ndi mndandanda wazinthu.
- Ndipo wina.
- Koma zikuwonetsedwa pamzere.
<ul class="list-inline">
<li class="list-inline-item">This is a list item.</li>
<li class="list-inline-item">And another one.</li>
<li class="list-inline-item">But they're displayed inline.</li>
</ul>
Kuyika mndandanda wamafotokozedwe
Gwirizanitsani mawu ndi mafotokozedwe molunjika pogwiritsa ntchito makalasi omwe tafotokozeratu (kapena ma semantic mixin). Pamawu ataliatali, mutha kuwonjezera .text-truncate
kalasi kuti muchepetse mawuwo ndi ellipsis.
- Mndandanda wamafotokozedwe
- Mndandanda wofotokozera ndi wabwino kufotokozera mawu.
- Nthawi
-
Tanthauzo la mawuwa.
Ndipo matanthauzo enanso otengera malo.
- Nthawi ina
- Tanthauzoli ndi lalifupi, kotero palibe ndime zowonjezera kapena chirichonse.
- Mawu odulidwa amadulidwa
- Izi zitha kukhala zothandiza ngati malo ali olimba. Imawonjezera ellipsis kumapeto.
- Nesting
-
- Mndandanda wa matanthauzo okhazikika
- Ndinakumvani mumakonda mindandanda yamatanthauzidwe. Ndiroleni ndiike mndandanda wa matanthauzo mkati mwa ndandanda yanu yomasulira.
<dl class="row">
<dt class="col-sm-3">Description lists</dt>
<dd class="col-sm-9">A description list is perfect for defining terms.</dd>
<dt class="col-sm-3">Term</dt>
<dd class="col-sm-9">
<p>Definition for the term.</p>
<p>And some more placeholder definition text.</p>
</dd>
<dt class="col-sm-3">Another term</dt>
<dd class="col-sm-9">This definition is short, so no extra paragraphs or anything.</dd>
<dt class="col-sm-3 text-truncate">Truncated term is truncated</dt>
<dd class="col-sm-9">This can be useful when space is tight. Adds an ellipsis at the end.</dd>
<dt class="col-sm-3">Nesting</dt>
<dd class="col-sm-9">
<dl class="row">
<dt class="col-sm-4">Nested definition list</dt>
<dd class="col-sm-8">I heard you like definition lists. Let me put a definition list inside your definition list.</dd>
</dl>
</dd>
</dl>
Makulidwe amitundu omvera
Mu Bootstrap 5, tathandizira masaizi amtundu womvera mwachisawawa, kulola kuti mawu azikula mwachilengedwe pazida zonse ndi kukula kwa mawonekedwe. Yang'anani pa tsamba la RFS kuti mudziwe momwe izi zimagwirira ntchito.
Sass
Zosintha
Mitu ili ndi zosintha zina zodzipatulira za kukula ndi masitayilo.
$headings-margin-bottom: $spacer * .5;
$headings-font-family: null;
$headings-font-style: null;
$headings-font-weight: 500;
$headings-line-height: 1.2;
$headings-color: null;
Mitundu yosiyanasiyana ya typography yomwe ili pano ndi mu Reboot ilinso ndi zosintha zodzipatulira.
$lead-font-size: $font-size-base * 1.25;
$lead-font-weight: 300;
$small-font-size: .875em;
$sub-sup-font-size: .75em;
$text-muted: $gray-600;
$initialism-font-size: $small-font-size;
$blockquote-margin-y: $spacer;
$blockquote-font-size: $font-size-base * 1.25;
$blockquote-footer-color: $gray-600;
$blockquote-footer-font-size: $small-font-size;
$hr-margin-y: $spacer;
$hr-color: inherit;
$hr-height: $border-width;
$hr-opacity: .25;
$legend-margin-bottom: .5rem;
$legend-font-size: 1.5rem;
$legend-font-weight: null;
$mark-padding: .2em;
$dt-font-weight: $font-weight-bold;
$nested-kbd-font-weight: $font-weight-bold;
$list-inline-padding: .5rem;
$mark-bg: #fcf8e3;
Zosakaniza
Palibe zosakaniza zodzipatulira za typography, koma Bootstrap imagwiritsa ntchito Responsive Font Sizing (RFS) .