Fa Bootstrap kyekyere nsɛmma nhoma ahorow a ɛyɛ ntɛm, ɛyɛ adwuma
Frontend adwinnade a tumi wom, wotumi trɛw mu, na ɛwɔ nneɛma pii. Fa Sass si na yɛ no sɛnea wopɛ, fa grid nhyehyɛe ne nneɛma a wɔadi kan ayɛ no di dwuma, na fa JavaScript plugins a ahoɔden wom ba nnwuma ba nkwa mu.
Install Bootstrap no fibea Sass ne JavaScript fael ahorow no denam npm, RubyGems, Composer, anaa Meteor so. Package managed installs no nka nkrataa anaa yɛn build scripts a edi mũ no ho. Wubetumi nso de yɛn npm template repo no adi dwuma de ayɛ Bootstrap project ntɛmntɛm denam npm so.
Sɛ ɛho hia sɛ wode Bootstrap CSS anaa JS a wɔaboaboa ano no nkutoo ka ho a, wubetumi de jsDelivr adi dwuma . Hwɛ no wɔ adeyɛ mu ne yɛn mfiase ntɛm a ɛnyɛ den , anaa hwehwɛ nhwɛso ahorow no mu na woahuruw ahyɛ wo adwuma a edi hɔ no ase. Wubetumi nso apaw sɛ wode Popper ne yɛn JS bɛka ho wɔ ɔkwan soronko so .
<!-- CSS only --><linkhref="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"rel="stylesheet"integrity="sha384-iYQeCzEYFbKjA/T2uDLTpkwGzCiq6soy8tYaI1GyVh/UjpbCx/TYkiZhlZB6+fzT"crossorigin="anonymous">
<!-- JavaScript Bundle with Popper --><scriptsrc="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"integrity="sha384-u1OknCvxWvY5kfmNBILK2hRnQC3Pr17a+RTT6rIHI7NnikvbZlHgTPOOmMi466C8"crossorigin="anonymous"></script>
Kenkan yɛn akwankyerɛ nhoma ahorow a ɛkyerɛ sɛnea wofi ase no
Nya ahuruhuruw wɔ Bootstrap fibea fael ahorow a wɔde bɛka ho wɔ adwuma foforo bi mu a yɛn aban akwankyerɛfo ka ho.
Bootstrap de Sass di dwuma ma modular ne customizable architecture. Fa nneɛma a wuhia nkutoo ba, ma wiase nyinaa nhyehyɛe te sɛ gradients ne shadows nyɛ adwuma, na fa yɛn variables, maps, functions, ne mixins kyerɛw w’ankasa CSS.
Import stylesheet biako na woakɔ mmirikatu ahorow no mu ne yɛn CSS no afã biara.
// Variable overrides first
$primary:#900;$enable-shadows:true;$prefix:"mo-";// Then import Bootstrap
@import"../node_modules/bootstrap/scss/bootstrap";
Si na trɛw mu wɔ bere ankasa mu ne CSS nsakrae ahorow
Bootstrap 5 rekɔ so wɔ bere biara a wɔayi no adi no mu de adi dwuma yiye ama CSS nsakrae ahorow ama wiase nyinaa asɛmti ahorow, ankorankoro afã horow, ne mpo mfaso horow. Yɛde nsakraeɛ du du pii ma kɔla, font styles, ne nea ɛkeka ho wɔ :rootlevel bi a wɔde bedi dwuma wɔ baabiara. Wɔ components ne utilities so no, wɔde CSS variables no scoped kɔ class a ɛfa ho no so na ɛnyɛ den sɛ wɔbɛsesa.
Fa yɛn wiase nyinaa :rootnsakrae biara di dwuma fa kyerɛw style foforo. CSS variables de var(--bs-variableName)syntax no di dwuma na mmofra elements betumi anya agyapade.
Override global, component, anaa utility class variables na woayɛ Bootstrap sɛnea wopɛ no pɛpɛɛpɛ. Ɛho nhia sɛ wobɛsan abɔ mmara biara ho dawuru, nsakrae bo foforo ara kwa.
Foforo wɔ Bootstrap 5 mu, yɛn utilities no afei de yɛn Utility API na ɛyɛ . Yɛkyekyeree no sɛ Sass map a ɛwɔ nneɛma pii a wobetumi ayɛ no ntɛmntɛm na ɛnyɛ den. Ɛnyɛ mmerɛw da sɛ wode utility class biara bɛka ho, ayi afi hɔ, anaasɛ wobɛsesa. Ma utilities nyɛ nea ɛyɛ adwuma, fa pseudo-class variants ka ho, na fa edin a wɔahyɛ da ayɛ ma wɔn.
// Create and extend utilities with the Utility API
@import"bootstrap/scss/bootstrap";$utilities:map-merge($utilities,("cursor":(property:cursor,class:cursor,responsive:true,values:autopointergrab,)));
JavaScript plugins a ahoɔden wom a jQuery nnim
Fa nneɛma a ahintaw a wotumi sesa, modals ne offcanvas menus, popovers ne tooltips, ne nea ɛkeka ho pii ka ho ntɛm —ne nyinaa a jQuery nni mu. JavaScript a ɛwɔ Bootstrap mu no yɛ HTML-a edi kan, a ɛkyerɛ sɛ plugins a wode bɛka ho no yɛ mmerɛw te sɛ nea wode dataattributes bɛka ho. Wohia tumi kɛse? Fa ankorankoro plugins ka ho wɔ nhyehyɛe kwan so.
Dɛn nti na wobɛkyerɛw JavaScript pii bere a wubetumi akyerɛw HTML no? Ɛkame ayɛ sɛ Bootstrap JavaScript plugins no nyinaa wɔ data API a edi kan, a ɛma wutumi de JavaScript di dwuma denam datasu ahorow a wode bɛka ho ara kwa so.
Bootstrap Icons yɛ open source SVG icon nhomakorabea a ɛwɔ glyphs bɛboro 1,500, a wɔde pii ka ho wɔ bere biara a wɔayi no adi. Wɔayɛ no sɛ ɛnyɛ adwuma wɔ adwuma biara mu, sɛ́ wode Bootstrap ankasa bedi dwuma anaasɛ womfa nni dwuma. Fa wɔn di dwuma sɛ SVGs anaa icon fonts—nnwuma abien no nyinaa ma wo vector scaling ne customization a ɛnyɛ den denam CSS so.
Fa Bootstrap kɔ ɔfa a edi hɔ no so denam nsɛmti a ɛyɛ fɛ a efi Bootstrap Nsɛmti gua a ɛyɛ aban de no so . Wɔasi nsɛmti wɔ Bootstrap so sɛ wɔn ankasa nhyehyɛe a wɔatrɛw mu, a ɛyɛ adefo a ɛwɔ nneɛma foforo ne plugins, nkrataa, ne nnwinnade a ɛyɛ den a wɔde si dan.