Source

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, hāʻawi manuahi ʻia e ka poʻe ma jsDelivr. 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-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" 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ā jQuery , Popper.js , a me kā mākou mau plugins JavaScript ponoʻī. E kau i kēia <script>mau s ma kahi kokoke i ka hopena o kāu mau ʻaoʻao, ma mua pono o ka hōʻailona pani </body>, i hiki ai iā lākou. Pono e hele mua ʻo jQuery, a laila Popper.js, a laila kā mākou JavaScript plugins.

Hoʻohana mākou i kā jQuery's slim build , akā kākoʻo pū ʻia ka mana piha.

<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>

E noʻonoʻo i nā ʻāpana hea e koi pono ai iā jQuery, kā mākou JS, a me Popper.js? Kaomi i ka loulou hōʻike ʻāpana ma lalo. Inā maopopo ʻole ʻoe e pili ana i ke ʻano o ka ʻaoʻao maʻamau, 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 iho no ka hōʻike ʻana a me ka hoʻonohonoho ʻana (pono pū kekahi Popper.js )
  • 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
  • Nā mea hana a me nā popovers no ka hōʻike ʻana a me ka hoʻonohonoho ʻana (pono pū kekahi Popper.js )
  • Scrollspy no ka hana scroll a me nā hoʻokele hoʻokele

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-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">

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

    <!-- Optional JavaScript -->
    <!-- jQuery first, then Popper.js, then Bootstrap JS -->
    <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" 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.

  • E hahai iā @getbootstrap ma Twitter .
  • Heluhelu a kau inoa ʻo The Official Bootstrap Blog .
  • E kamaʻilio me nā hoa Bootstrappers ma IRC. Ma ke irc.freenode.netkikowaena, 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.