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 hele 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 href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
JS
Pono ka nui o kā mākou mau mea i ka hoʻohana ʻana iā JavaScript e hana. ʻO ke kikoʻī, koi lākou i kā mākou JavaScript plugins a me Popper . 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.
Puʻupuʻu
Hoʻohui i kēlā me kēia Bootstrap JavaScript plugin a me ka hilinaʻi me kekahi o kā mākou pūʻulu ʻelua. ʻO nā mea ʻelua bootstrap.bundle.js
a bootstrap.bundle.min.js
me Popper no kā mākou mea hana a me nā popovers. 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/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" 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/@popperjs/[email protected]/dist/umd/popper.min.js" integrity="sha384-IQsoLXl5PILFhosVNubq5LC7Qb9DXgDA9i+tQ8Zj3iwWAwPtgFTxbJ8NT4GN1R8p" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-cVKIPhGWiC2Al4u+LWgxfKTRIcfu0JTxR+EQDz/bgldoEyl4H0zUF0QKbrJ0EcQF" crossorigin="anonymous"></script>
Modules
Inā hoʻohana ʻoe <script type="module">
, e ʻoluʻolu e nānā i kā mākou hoʻohana ʻana iā Bootstrap ma ke ʻano he ʻāpana module .
Nā ʻāpana
Makemake ʻoe i nā ʻāpana e koi pono i kā mākou JavaScript a me Popper? Kaomi i ka loulou hōʻike ʻāpana ma lalo. Inā ʻaʻole maopopo ʻ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 a pau, nā mana, a me nā hōʻailona
- E hāʻule no ka hoʻololi ʻana i ka ʻike 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
- Toasts no ka hōʻike ʻana a me ka hoʻokuʻu ʻana
- Nā mea hana a me nā popovers no ka hōʻike ʻana a me ka hoʻonohonoho ʻana (pono pū kekahi Popper )
- 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">
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<title>Hello, world!</title>
</head>
<body>
<h1>Hello, world!</h1>
<!-- Optional JavaScript; choose one of the two! -->
<!-- Option 1: Bootstrap Bundle with Popper -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
<!-- Option 2: Separate Popper and Bootstrap JS -->
<!--
<script src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js" integrity="sha384-IQsoLXl5PILFhosVNubq5LC7Qb9DXgDA9i+tQ8Zj3iwWAwPtgFTxbJ8NT4GN1R8p" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-cVKIPhGWiC2Al4u+LWgxfKTRIcfu0JTxR+EQDz/bgldoEyl4H0zUF0QKbrJ0EcQF" crossorigin="anonymous"></script>
-->
</body>
</html>
No nā ʻanuʻu aʻe, 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ā e hoʻopaʻa mua ai mākou i nā code no nā polokalamu kelepona a laila e 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">
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-sizing
waiwai honua mai content-box
ka 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 ::before
a - e loaʻa i nā mea ::after
āpau i ʻōlelo ʻia box-sizing
no kēlā .selector-for-some-widget
.
E aʻo hou 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.chat
kikowaena, ma ke#bootstrap
kahawai. - Hiki ke loaʻa ke kōkua hoʻokō ma Stack Overflow (tagged
bootstrap-5
). - Pono nā mea hoʻomohala e hoʻohana i ka huaʻōlelo
bootstrap
ma nā pūʻolo e hoʻololi a hoʻohui paha i ka hana o Bootstrap i ka wā e puʻunaue ai 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 weliweli loa.