Twe kɔ emu nsɛm atitiriw no so Twe kɔ docs navigation so
Check
in English

Reboot no bio

Reboot, element-specific CSS nsakraeɛ a wɔaboaboa ano wɔ fael baako mu, kickstart Bootstrap ma ɛde mfitiaseɛ a ɛyɛ fɛ, ɛkɔ so daa, na ɛnyɛ den a wobɛsi so.

Kwan

Reboot gyina Normalize so, ɛma HTML elements pii a ɛwɔ adwene bi a ɛwɔ adwene a wɔde element selectors nkutoo di dwuma. Wɔde adesua ahorow nkutoo na ɛyɛ styling foforo. Sɛ nhwɛso no, yɛsan bɔ <table>style ahorow bi ma baseline a ɛyɛ mmerɛw na akyiri yi yɛde .table, .table-bordered, ne nea ɛkeka ho ma.

Yɛn akwankyerɛ ne ntease ahorow a enti ɛsɛ sɛ wopaw nea ɛsɛ sɛ wobɔ so wɔ Reboot mu ni:

  • Yɛ browser default values ​​binom foforo na fa rems di dwuma sen sɛ wode s bedi dwuma emama scalable component spacing.
  • Kwati sɛ margin-top. Nneɛma a ɛwɔ nkyɛnkyɛn a ɛda hɔ gyina hɔ no betumi abubu, na ɛde nneɛma a wɔnhwɛ kwan aba. Nanso nea ɛho hia kɛse no, akwankyerɛ biako a wɔde ma marginne adwene mu nhwɛso a ɛyɛ mmerɛw.
  • Sɛnea ɛbɛyɛ a ɛbɛyɛ mmerɛw sɛ wobɛma scaling wɔ device sizes nyinaa mu no, ɛsɛ sɛ block elements de s di dwuma remma margins.
  • Ma mpaemuka a fontɛfa -a ɛfa agyapade ho no nyɛ nea ɛba fam koraa, fa di dwuma inheritbere biara a ɛbɛyɛ yiye.

CSS nsakrae ahorow

Wɔde aka ho wɔ v5.2.0 mu

Yɛnam v5.1.1 so no, yɛde yɛn @imports a yɛhwehwɛ no yɛɛ gyinapɛn wɔ yɛn CSS bundles nyinaa mu (a bootstrap.css, bootstrap-reboot.css, ne bootstrap-grid.css) ka ho de ka ho _root.scss. Wei de :rootlevel CSS variables ka bundles nyinaa ho, a emu dodoɔ a wɔde di dwuma wɔ saa bundle no mu mfa ho. Awiei koraa no Bootstrap 5 bɛkɔ so ahu CSS nsakrae pii a wɔde aka ho bere kɔ so, sɛnea ɛbɛyɛ a ɛbɛma bere ankasa mu nsakrae pii a ɛho nhia sɛ wɔsan boaboa Sass ano bere nyinaa. Yɛn kwan ne sɛ yɛbɛfa yɛn source Sass variables no na yɛadan no ayɛ no CSS variables. Saa kwan no so no, sɛ woamfa CSS variables anni dwuma mpo a, woda so ara wɔ Sass tumi nyinaa. Eyi da so ara rekɔ so na ebegye bere na wɔde adi dwuma koraa.

Sɛ nhwɛso no, susuw :rootCSS nsakrae ahorow yi ho ma <body>style ahorow a wɔtaa de di dwuma:

  @if $font-size-root != null {
    --#{$prefix}root-font-size: #{$font-size-root};
  }
  --#{$prefix}body-font-family: #{$font-family-base};
  @include rfs($font-size-base, --#{$prefix}body-font-size);
  --#{$prefix}body-font-weight: #{$font-weight-base};
  --#{$prefix}body-line-height: #{$line-height-base};
  --#{$prefix}body-color: #{$body-color};
  @if $body-text-align != null {
    --#{$prefix}body-text-align: #{$body-text-align};
  }
  --#{$prefix}body-bg: #{$body-bg};
  

Wɔ adeyɛ mu no, afei wɔde saa variables no di dwuma wɔ Reboot mu te sɛ saa:

body {
  margin: 0; // 1
  font-family: var(--#{$prefix}body-font-family);
  @include font-size(var(--#{$prefix}body-font-size));
  font-weight: var(--#{$prefix}body-font-weight);
  line-height: var(--#{$prefix}body-line-height);
  color: var(--#{$prefix}body-color);
  text-align: var(--#{$prefix}body-text-align);
  background-color: var(--#{$prefix}body-bg); // 2
  -webkit-text-size-adjust: 100%; // 3
  -webkit-tap-highlight-color: rgba($black, 0); // 4
}

Nea ɛma wo kwan ma woyɛ bere ankasa mu nsakrae sɛnea wopɛ biara:

<body style="--bs-body-color: #333;">
  <!-- ... -->
</body>

Kratafa no yɛ nea wɔahyɛ da ayɛ

Wɔayɛ <html>ne <body>elements no foforo de ama kratafa no nyinaa defaults a eye. Nea ɛkɔ akyiri yi:

  • Wɔde box-sizingwiase nyinaa asi element biara so—a *::beforene , ka ho *::after, kosi border-box. Wei hwɛ sɛ element no trɛw a wɔabɔ ho dawuru no rentra da esiane padding anaa border nti.
    • Wɔmmɔ nnyinaso font-sizebiara ho dawuru wɔ <html>, nanso 16pxwɔfa no sɛ (browsa no default). font-size: 1remwɔde di dwuma wɔ the <body>for easy responsive type-scaling via media queries bere a wɔkyerɛ obu ma nea ɔde di dwuma no apɛde na ɛhwɛ hu sɛ wɔfa ɔkwan a ɛyɛ mmerɛw so. Wobetumi abɔ browser default yi so denam nsakrae a wobɛsakra no $font-size-rootso.
  • The <body>nso de wiase nyinaa font-family, font-weight, line-height, ne color. Eyi fi awo mu akyiri yi denam form elements binom so de siw font a enhyia ano.
  • Sɛnea ɛbɛyɛ a ahobammɔ bɛba no, the <body>has a background-colordeclared , defaulting to #fff.

Native font a wɔde ahyɛ mu

Bootstrap de “native font stack” anaa “system font stack” di dwuma ma nsɛm a wɔkyerɛ ase yiye wɔ mfiri ne OS biara so. Wɔayɛ nhyehyɛe font ahorow yi titiriw a nnɛyi mfiri ahorow no wɔ wɔn adwenem, a wɔatu mpɔn wɔ nkyerɛase ahorow so, font ahorow a ɛsakra, ne nea ɛkeka ho. Kenkan native font stacks ho nsɛm pii wɔ Smashing Magazine asɛm yi mu .

$font-family-sans-serif:
  // Cross-platform generic font family (default user interface font)
  system-ui,
  // Safari for macOS and iOS (San Francisco)
  -apple-system,
  // Windows
  "Segoe UI",
  // Android
  Roboto,
  // older macOS and iOS
  "Helvetica Neue"
  // Linux
  "Noto Sans",
  "Liberation Sans",
  // Basic web fallback
  Arial,
  // Sans serif fallback
  sans-serif,
  // Emoji fonts
  "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji" !default;

Hyɛ no nsow sɛ esiane sɛ font stack no de emoji fonts ka ho nti, wɔbɛkyerɛ agyiraehyɛde/dingbat Unicode nkyerɛwde a wɔtaa de di dwuma no pii ase sɛ mfonini ahorow a ɛwɔ kɔla ahorow pii. Wɔn hwɛbea bɛsono, a egyina ɔkwan a wɔfa so de di dwuma wɔ browser/platform no native emoji font no so, na CSS colorkwan biara rennya wɔn so nkɛntɛnso.

Eyi font-familyyɛ nea wɔde di dwuma wɔ <body>ne automatically inherited wiase nyinaa wɔ Bootstrap nyinaa mu. Sɛ wopɛ sɛ wosakra global font-family, update $font-family-basena san boaboa Bootstrap ano.

Nsɛmti ne nkyekyɛm ahorow

Asɛmti no mu nneɛma nyinaa—sɛ nhwɛso no, <h1>—na <p>wɔsan de si hɔ sɛnea ɛbɛyɛ a wobeyi wɔn margin-topafi hɔ. Wɔde nsɛmti ahorow margin-bottom: .5remaka ho ne nkyekyem margin-bottom: 1remahorow a ɛbɛma ntam kwan ayɛ mmerɛw.

Asɛmti Nhwɛsoɔ
<h1></h1> h1. Bootstrap asɛmti no
<h2></h2> h2. Bootstrap asɛmti no
<h3></h3> h3. Bootstrap asɛmti no
<h4></h4> h4. Bootstrap asɛmti no
<h5></h5> h5. Bootstrap asɛmti no
<h6></h6> h6. Bootstrap asɛmti no

Mmara a ɛwɔ sorosoro

Wɔama <hr>element no ayɛ mmerɛw. Te sɛ browser defaults no, <hr>s yɛ styled via border-top, wɔ default opacity: .25, na automatically inherit wɔn border-colorvia color, a bere colora set via ɔwofo no ka ho. Wobetumi de text, border, ne opacity utilities ayɛ nsakrae wɔ mu.





html na ɛwɔ hɔ
<hr>

<div class="text-success">
  <hr>
</div>

<hr class="border border-danger border-2 opacity-50">
<hr class="border border-primary border-3 opacity-75">

Nsɛm a wɔahyehyɛ

Lists nyinaa— <ul>, <ol>, ne <dl>—wɔ wɔn a margin-topwɔayi afi hɔ ne a margin-bottom: 1rem. Nested list ahorow no nni margin-bottom. Yɛsan nso reset padding-lefton <ul>ne <ol>elements no.

  • Wɔayi wɔn atifi margin no afi hɔ a wɔahyehyɛ no nyinaa
  • Na wɔn ase fã no yɛɛ nea ɛfata
  • Nested lists nni ase fã biara
    • Saa kwan yi so no wonya anim a ɛyɛ pɛpɛɛpɛ kɛse
    • Titiriw bere a nneɛma pii a wɔahyehyɛ di akyi no
  • Wɔasan asiesie benkum so padding no nso
  1. Nsɛm a wɔahyehyɛ a wɔahyehyɛ ni
  2. Ne nneɛma kakraa bi a wɔahyehyɛ
  3. Ɛwɔ ne nyinaa hwɛbea koro no ara
  4. Sɛnea edi kan a wɔanhyehyɛ no din no

Sɛnea ɛbɛyɛ a wobɛhyehyɛ no mmerɛw, nhyehyɛe a emu da hɔ, ne ntam kwan a eye no, nkyerɛkyerɛmu list ahorow no ayɛ margins foforo. <dd>s reset margin-leftto 0na fa ka ho margin-bottom: .5rem. <dt>s no yɛ nkyerɛwde tuntum .

Nkyerɛkyerɛmu a wɔahyehyɛ
Nkyerɛkyerɛmu a wɔahyehyɛ no yɛ pɛpɛɛpɛ ma nsɛmfua nkyerɛase.
Asɛmfua
Nkyerɛase a wɔde ma asɛmfua no.
Nkyerɛase a ɛto so abien ma asɛmfua koro no ara.
Asɛmfua foforo
Nkyerɛase a wɔde ma wɔ asɛmfua foforo yi ho.

Inline koodu a ɛwɔ mu

Fa inline snippets a ɛwɔ code no mu no kyekyere <code>. Hwɛ hu sɛ wubeguan afi HTML anim brackets no mu.

Sɛ nhwɛso no, <section>ɛsɛ sɛ wɔkyekyere no sɛ inline.
html na ɛwɔ hɔ
For example, <code>&lt;section&gt;</code> should be wrapped as inline.

Kood a wɔde siw ano

Fa <pre>s di dwuma ma koodu nkyerɛwde ahorow pii. Saa bere yi nso, hwɛ hu sɛ wubeguan afi anim brackets biara a ɛwɔ code no mu no mu na ama woatumi akyerɛ ase yiye. Wɔsan <pre>de element no si hɔ de yi ne margin-topna wɔde remunits di dwuma ma ne margin-bottom.

<p>Sample text here...</p>
<p>And another line of sample text here...</p>
html na ɛwɔ hɔ
<pre><code>&lt;p&gt;Sample text here...&lt;/p&gt;
&lt;p&gt;And another line of sample text here...&lt;/p&gt;
</code></pre>

Nneɛma a Ɛsakra

Sɛ wopɛ sɛ wokyerɛ variables a, fa <var>tag no di dwuma.

y = m x + b
html na ɛwɔ hɔ
<var>y</var> = <var>m</var><var>x</var> + <var>b</var>

Ɔdefo no nsɛm a wɔde hyɛ mu

Fa no <kbd>kyerɛ input a wɔtaa fa keyboard so hyɛ mu.

Sɛ wopɛ sɛ wosakra directory ahorow no a, kyerɛw directory cdno din na di akyi.
Sɛ wopɛ sɛ wosakra nhyehyɛe ahorow no a, mia so ctrl + ,
html na ɛwɔ hɔ
To switch directories, type <kbd>cd</kbd> followed by the name of the directory.<br>
To edit settings, press <kbd><kbd>ctrl</kbd> + <kbd>,</kbd></kbd>

Nhwɛsode a efi mu ba

Sɛ wopɛ sɛ wokyerɛ nhwɛsode a efi dwumadi 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.
html na ɛwɔ hɔ
<samp>This text is meant to be treated as sample output from a computer program.</samp>

Nnwinnade ahorow

Wɔayɛ pon ahorow no ho nhyehyɛe kakra ma ɛne style <caption>s, collapse borders, na wɔhwɛ hu sɛ ɛkɔ so daa wɔ ne text-alignnyinaa mu. Nsakrae foforo a ɛfa borders, padding, ne nea ɛkeka ho no ka .tableadesuakuw no ho .

Eyi yɛ nhwɛso pon, na eyi ne ne nsɛm a wɔakyerɛw a wɔde kyerɛkyerɛ emu nsɛm no mu.
Table asɛmti Table asɛmti Table asɛmti Table asɛmti
Table cell Table cell Table cell Table cell
Table cell Table cell Table cell Table cell
Table cell Table cell Table cell Table cell
html na ɛwɔ hɔ
<table>
  <caption>
    This is an example table, and this is its caption to describe the contents.
  </caption>
  <thead>
    <tr>
      <th>Table heading</th>
      <th>Table heading</th>
      <th>Table heading</th>
      <th>Table heading</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Table cell</td>
      <td>Table cell</td>
      <td>Table cell</td>
      <td>Table cell</td>
    </tr>
    <tr>
      <td>Table cell</td>
      <td>Table cell</td>
      <td>Table cell</td>
      <td>Table cell</td>
    </tr>
    <tr>
      <td>Table cell</td>
      <td>Table cell</td>
      <td>Table cell</td>
      <td>Table cell</td>
    </tr>
  </tbody>
</table>

Nkyerɛwee ahorow

Wɔasan ahyɛ form elements ahorow ase ama base styles a ɛyɛ mmerɛw. Nsakrae a ɛda nsow sen biara no bi ni:

  • <fieldset>s nni borders, padding, anaa margin enti wobetumi de adi dwuma mmerɛw sɛ wrappers ama ankorankoro inputs anaa inputs akuw.
  • <legend>s, te sɛ fieldsets, nso wɔasan ayɛ no foforo sɛnea ɛbɛyɛ a wɔbɛda no adi sɛ asɛmti a ɛyɛ ahorow.
  • <label>s no wɔde asi hɔ sɛ display: inline-blockwɔbɛma kwan marginma wɔde adi dwuma.
  • <input>s, <select>s, <textarea>s, ne <button>s no, Normalize na ɛdi ho dwuma dodoɔ no ara, nanso Reboot yi wɔn marginne set line-height: inherit, nso.
  • <textarea>s no yɛ nsakrae ma ɛyɛ nea wotumi sesa ne kɛse vertically nkutoo sɛnea horizontal resizing taa “bubu” kratafa nhyehyɛe no.
  • <button>s ne <input>button elements no wɔ cursor: pointerbere a :not(:disabled).

Wɔada nsakrae ahorow yi, ne nea ɛkeka ho adi wɔ ase ha.

Nhwɛso anansesɛm

100 na ɛwɔ hɔ

Date & kɔla a wɔde hyɛ mu mmoa

Ma ɛntena w’adwenem sɛ date inputs no ntumi nhyɛ browser ahorow nyinaa mu koraa, a ɛne Safari.

Nsɛnkyerɛnne a ɛwɔ bɔton ahorow so

Reboot no de nkɔsoɔ bi ka ho ma role="button"sɛ wobɛsesa default cursor no akɔ pointer. Fa saa su yi ka element ahorow ho na aboa ma akyerɛ sɛ element ahorow no yɛ nkitahodi. Saa dwumadie yi nhia mma <button>elements, a wonya wɔn ankasa cursornsakraeɛ.

Nneɛma a ɛnyɛ bɔtn no bɔtn
html na ɛwɔ hɔ
<span role="button" tabindex="0">Non-button element button</span>

Misc nneɛma ahorow

Adrɛse

Wɔayɛ <address>element no foforo de asan ahyɛ browser no default no font-styleafi italicnormal. line-heightno nso mprempren anya agyapade, na margin-bottom: 1remwɔde aka ho. <address>s yɛ nea wɔde bɛma nana a ɔbɛn no paa (anaasɛ adwuma mũ no nyinaa) nkitahodi ho nsɛm. Kora formatting so denam nkyerɛwde a wode bɛhyɛ awiei no so <br>.

1355
Market St, Suite 900
San Francisco, CA 94103
P: (123)
Edin mũ no nyinaa
[email protected]

Nsɛm a wɔde siw ano

Default margina ɛwɔ blockquotes so ne 1em 40px, enti yɛsan de saa to 0 0 1remhɔ ma biribi a ɛne nneɛma afoforo hyia kɛse.

Asɛm a wɔafa aka a wonim no yiye, a ɛwɔ blockquote element bi mu.

Obi a wagye din wɔ Source Title mu

Nneɛma a ɛwɔ inline mu

Element <abbr>no nya mfitiase styling ma ɛda nsow wɔ nkyekyɛm nsɛm mu.

HTML a wɔatwa no tiaa ade no.

Tɔfabɔ

Default cursorwɔ summary so ne text, enti yɛsan de saa to pointerno de kyerɛ sɛ wobetumi ne element no adi nkitaho denam klik a wobɛbɔ so.

Nsɛm bi a ɛkɔ akyiri

More info fa nsɛm no ho.

Nsɛm pii mpo

Nsɛm pii mpo a ɛfa nsɛm no ho ni.

HTML5 [hidden]su a ɛwɔ hɔ

HTML5 de wiase nyinaa su foforo a wɔato din[hidden] , a wɔayɛ no sɛnea display: noneɛte no ka ho. Borrowing an idea from PureCSS , yɛtu mpɔn wɔ saa default yi so denam yɛ a yɛbɛyɛ [hidden] { display: none !important; }de aboa ma wɔasiw ne displaykwan sɛ ɛbɛba so wɔ akwanhyia mu no so.

<input type="text" hidden>
jQuery a ɛne ne ho nhyia

[hidden]no ne jQuery's $(...).hide()ne $(...).show()akwan horow no nhyia. Enti, mprempren yɛnyɛ titiriw endorse [hidden]over akwan afoforo a wɔfa so di displayof elements no ho dwuma.

Sɛ wopɛ sɛ wodannan element bi a wotumi hu no ara kwa, a ɛkyerɛ displaysɛ wɔansakra ne na element no da so ara tumi nya krataa no nsu a ɛsen no so nkɛntɛnso a, fa adesuakuw no.invisible di dwuma mmom.