in English

Hoʻolauna

E hoʻomaka me Bootstrap, ka papa hana kaulana loa o ka honua no ke kūkulu ʻana i ka pane ʻana, nā paena mobile-mua, me jsDelivr a me kahi ʻaoʻao hoʻomaka.

Hoʻomaka wikiwiki

Ke ʻimi nei e hoʻohui koke iā Bootstrap i kāu papahana? E hoʻohana i ka jsDelivr, kahi CDN manuahi manuahi. Ke hoʻohana nei i kahi luna pūʻolo a pono e hoʻoiho i nā faila kumu? E poʻo i ka ʻaoʻao downloads .

CSS

E kope-paʻi i ka pepa style <link>ma <head>mua o nā pepa ʻē aʻe a pau e hoʻouka i kā mākou CSS.

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-xOolHFLEh07PJGoPkLv1IbcEPTNtaed2xpHsD9ESMhqIYd0nLMwNLD69Npy4HI+N" crossorigin="anonymous">

JS

Pono ka nui o kā mākou mau mea i ka hoʻohana ʻana iā JavaScript e hana. ʻO ka mea kikoʻī, koi lākou i ka jQuery , Popper , a me kā mākou mau plugins JavaScript ponoʻī. Hoʻohana mākou i kā jQuery's slim build , akā kākoʻo pū ʻia ka mana piha.

E kau i kekahi o kēia <script>mau ʻaoʻao ma kahi kokoke i ka hope o kāu mau ʻaoʻao, ma mua pono o ka hōʻailona pani </body>, e hiki ai iā lākou. Pono e hele mua ʻo jQuery, a laila Popper, a laila kā mākou JavaScript plugins.

Puʻupuʻu

Hoʻohui i kēlā me kēia Bootstrap JavaScript plugin me kekahi o kā mākou pūʻulu ʻelua. ʻO nā mea ʻelua bootstrap.bundle.jsa bootstrap.bundle.min.jsme Popper no kā mākou mea hana a me nā popovers, akā ʻaʻole jQuery . E hoʻokomo i ka jQuery ma mua, a laila kahi pūʻolo JavaScript Bootstrap. No ka ʻike hou aku e pili ana i nā mea i komo i loko o Bootstrap, e ʻoluʻolu e ʻike i kā mākou ʻatikala .

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-Fy6S3B9q64WdZWQUiU+q4/2Lc9npb8tCaSX9FK7E8HnRr0Jz8D6OP9dO5Vg3Q9ct" crossorigin="anonymous"></script>

Hoʻokaʻawale

Inā hoʻoholo ʻoe e hele me ka hoʻonā palapala ʻokoʻa, pono e hele mua ʻo Popper (inā ʻoe e hoʻohana ana i nā hāmeʻa a i ʻole popovers), a laila kā mākou JavaScript plugins.

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-+sLIOodYLS7CIrQpBjl+C7nPvqq+FbNUBDunl/OZv93DB7Ln/533i8e/mZXLi/P+" crossorigin="anonymous"></script>

Nā ʻāpana

E noʻonoʻo i nā ʻāpana e koi pono i ka jQuery, kā mākou JavaScript, a me Popper? Kaomi i ka loulou hōʻike ʻāpana ma lalo. Inā maopopo ʻole ʻoe e pili ana i ke ʻano o ka ʻaoʻao, e hoʻomau i ka heluhelu ʻana no kahi laʻana ʻaoʻao.

Hōʻike i nā ʻāpana e koi ana iā JavaScript
  • ʻŌlelo no ka hoʻokuʻu ʻana
  • Nā pihi no ka hoʻololi ʻana i nā mokuʻāina a me ka hana pahu pahu
  • Carousel no nā ʻano paheʻe, nā mana, a me nā hōʻailona
  • E hāʻule no ka hoʻololi ʻana i ka ʻike ʻana o ka ʻike
  • Nā hāʻule no ka hōʻike ʻana a me ka hoʻonohonoho ʻana (pono pū kekahi Popper )
  • Nā ʻano no ka hōʻike ʻana, ka hoʻonohonoho ʻana, a me ka hana ʻōwili
  • Navbar no ka hoʻonui ʻana i kā mākou Collapse plugin e hoʻokō i ka ʻano pane
  • Scrollspy no ka hana scroll a me nā hoʻokele hoʻokele
  • Nā mea hana a me nā popovers no ka hōʻike ʻana a me ka hoʻonohonoho ʻana (pono pū kekahi Popper )

Hoʻopalapala hoʻomaka

E hoʻopaʻa pono i kāu mau ʻaoʻao me nā kūlana hoʻolālā a me ka hoʻomohala hou loa. ʻO ia ke ʻano o ka hoʻohana ʻana i kahi doctype HTML5 a me ka hōʻailona meta viewport no nā ʻano pane kūpono. E hoʻohui i nā mea a pau a penei kāu mau ʻaoʻao:

<!doctype html>
<html lang="en">
  <head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-xOolHFLEh07PJGoPkLv1IbcEPTNtaed2xpHsD9ESMhqIYd0nLMwNLD69Npy4HI+N" crossorigin="anonymous">

    <title>Hello, world!</title>
  </head>
  <body>
    <h1>Hello, world!</h1>

    <!-- Optional JavaScript; choose one of the two! -->

    <!-- Option 1: jQuery and Bootstrap Bundle (includes Popper) -->
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-Fy6S3B9q64WdZWQUiU+q4/2Lc9npb8tCaSX9FK7E8HnRr0Jz8D6OP9dO5Vg3Q9ct" crossorigin="anonymous"></script>

    <!-- Option 2: Separate Popper and Bootstrap JS -->
    <!--
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-+sLIOodYLS7CIrQpBjl+C7nPvqq+FbNUBDunl/OZv93DB7Ln/533i8e/mZXLi/P+" crossorigin="anonymous"></script>
    -->
  </body>
</html>

ʻO ia wale nō kāu e pono ai no nā koi ʻaoʻao holoʻokoʻa. E kipa i ka Layout docs a i ʻole kā mākou mau hiʻohiʻona kūhelu e hoʻomaka i ka waiho ʻana i nā ʻike a me nā ʻāpana o kāu pūnaewele.

Nā honua koʻikoʻi

Hoʻohana ʻo Bootstrap i kahi lima o nā kaila honua koʻikoʻi a me nā hoʻonohonoho e pono ai ʻoe e makaʻala i ka wā e hoʻohana ai iā ia, ʻo ia mau mea a pau e pili wale ana i ka hoʻoponopono ʻana i nā ʻano polokalamu kele pūnaewele. E luʻu kākou.

HTML5 doctype

Pono ʻo Bootstrap i ka hoʻohana ʻana i ka HTML5 doctype. Inā ʻaʻole ia, e ʻike ʻoe i kahi ʻano leʻaleʻa piha ʻole, akā ʻaʻole pono ia e hoʻoulu i nā hiccups nui.

<!doctype html>
<html lang="en">
  ...
</html>

ʻO ka tag meta pane

Hoʻokumu mua ʻia ʻo Bootstrap i ka mobile , kahi hoʻolālā kahi e hoʻopaʻa mua ai mākou i nā code no nā polokalamu kelepona a laila hoʻonui i nā mea e pono ai me ka hoʻohana ʻana i nā nīnau media CSS. No ka hōʻoia ʻana i ka hāʻawi pono ʻana a me ka hoʻopā ʻana i nā hāmeʻa a pau, e hoʻohui i ka tag meta viewport pane i kāu <head>.

<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

Hiki iā ʻoe ke ʻike i kahi hiʻohiʻona o kēia i ka hana ma ka template starter .

Ka nui pahu

No ka hoʻonui pololei ʻana i ka CSS, hoʻololi mākou i ka box-sizingwaiwai honua mai content-boxka border-box. paddingʻAʻole pili kēia i ka laulā helu hope o kahi mea, akā hiki ke hoʻopilikia i kekahi polokalamu ʻaoʻao ʻekolu e like me Google Maps a me Google Custom Search Engine .

I ka manawa kakaikahi pono ʻoe e hoʻopau iā ia, e hoʻohana i kahi mea e like me kēia:

.selector-for-some-widget {
  box-sizing: content-box;
}

Me ka snippet i luna, nā mea i hoʻopaʻa ʻia-me ka ʻike i hana ʻia ma o ::beforea - e loaʻa i nā mea ::afterāpau i ʻōlelo ʻia box-sizingno kēlā .selector-for-some-widget.

E aʻo hou aʻe e pili ana i ka pahu pahu a me ka nui ʻana ma CSS Tricks .

Hoʻomaka hou

No ka hoʻomaikaʻi ʻana i ka hoʻololi ʻana i ka polokalamu kele pūnaewele, hoʻohana mākou i ka Reboot e hoʻoponopono i nā ʻokoʻa like ʻole ma waena o nā polokalamu kele pūnaewele a me ka hāʻawi ʻana i nā manaʻo hou i nā mea HTML maʻamau.

Kaiāulu

E hoʻomau i ka hoʻomohala ʻana o Bootstrap a hiki i ke kaiāulu me kēia mau kumuwaiwai kōkua.

  • Heluhelu a kau inoa ʻo The Official Bootstrap Blog .
  • E kamaʻilio me nā hoa Bootstrappers ma IRC. Ma ke irc.libera.chatkikowaena, ma ke #bootstrapkahawai.
  • Hiki ke loaʻa ke kōkua hoʻokō ma Stack Overflow (tagged bootstrap-4).
  • Pono nā mea hoʻomohala e hoʻohana i ka huaʻōlelo bootstrapma nā pūʻolo e hoʻololi a hoʻohui paha i ka hana o Bootstrap i ka wā e kahele ʻana ma o npm a i ʻole nā ​​​​mea hoʻopuka like ʻole no ka ʻike kiʻekiʻe.

Hiki iā ʻoe ke hahai iā @getbootstrap ma Twitter no nā wikiō mele maikaʻi loa.

Nā CSP a me nā SVG i hoʻopili ʻia

Aia kekahi mau ʻāpana Bootstrap i nā SVG i hoʻokomo ʻia i kā mākou CSS e hana i nā ʻāpana like ʻole a maʻalahi hoʻi ma waena o nā polokalamu kele pūnaewele a me nā polokalamu. No nā hui me nā hoʻonohonoho CSP koʻikoʻi , ua kākau mākou i nā manawa a pau o kā mākou SVG i hoʻokomo ʻia (ua hoʻopili ʻia nā mea a pau ma o background-image) no laila hiki iā ʻoe ke nānā pono i kāu mau koho.

Ma muli o ke kamaʻilio kaiaulu , ʻo kekahi mau koho no ka hoʻoponopono ʻana i kēia ma kāu codebase ponoʻī e pili ana i ka hoʻololi ʻana i nā URL me nā waiwai i mālama ʻia ma ka ʻāina, ka wehe ʻana i nā kiʻi a me ka hoʻohana ʻana i nā kiʻi inline (ʻaʻole hiki i nā mea āpau), a me ka hoʻololi ʻana i kāu CSP. ʻO kā mākou manaʻo e nānā pono i kāu mau kulekele palekana a hoʻoholo i kahi ala maikaʻi loa i mua, inā pono.