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.

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.
  • The <body>nso de wiase nyinaa font-family, line-height, ne text-align. 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

Wɔagyae wɛb nkyerɛwde a wɔde ahyɛ hɔ (Helvetica Neue, Helvetica, ne Arial) wɔ Bootstrap 4 mu na wɔde “native font stack” asi ananmu ama nsɛm a wɔbɛkyerɛ ase yiye wɔ mfiri ne OS biara so. Kenkan native font stacks ho nsɛm pii wɔ Smashing Magazine asɛm yi mu .

$font-family-sans-serif:
  // Safari for macOS and iOS (San Francisco)
  -apple-system,
  // Chrome < 56 for macOS (San Francisco)
  BlinkMacSystemFont,
  // Windows
  "Segoe UI",
  // Android
  Roboto,
  // Basic web fallback
  "Helvetica Neue", Arial,
  // Linux
  "Noto Sans",
  "Liberation Sans",
  // 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

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.

  • 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.

Nsɛm a wɔadi kan ayɛ no format

Wɔsan <pre>de element no si hɔ de yi ne margin-topna wɔde remunits di dwuma ma ne margin-bottom.

.nhwɛsoɔ-adeɛ { .
  margin-ase: 1rem;
} .

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

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ɔ

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
<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.

Nulla attr vitae elit libero, a ɛyɛ aduru a wɔde yɛ aduan.

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. Bere [hidden]a ɛnyɛ natively supported by IE10, pefee mpaemuka wɔ yɛn CSS no di saa ɔhaw no ho dwuma.

<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.