Wotu bootstrap ɖe sɔti 12 ƒe grid si ɖoa nya ŋu dzi. Míetsɔ ɖoɖo siwo wotu ɖe ɖoɖo ma dzi siwo ƒe kekeme le ɖoɖo nu kple esiwo ƒe kekeme le tsia dzi hã de eme.
Bootstrap wɔa HTML ƒe akpawo kple CSS ƒe nɔnɔme siwo hiã be woazã HTML5 doctype la ŋudɔ. Kpɔ egbɔ be yetsɔe de Bootstrapped ƒe axa ɖesiaɖe ƒe gɔmedzedze le wò dɔa me.
- <!NUŊLƆÐI ƑE ƑOMEVI html>
- <html lang = "ebe" >
- ...
- </html> ƒe nyawo
Le scaffolding.less faɛl la me la, míeɖo xexeame katã ƒe ɖeɖefia veviwo, nuŋɔŋlɔ, kple kadodo ƒe atsyãwo. Etɔxɛe la, mí:
background-color: white;
ɖe...body
@baseFontFamily
, @baseFontSize
, kple @baseLineHeight
nɔnɔmewo abe míaƒe nuŋɔŋlɔ ƒe gɔmeɖoanyi ene@linkColor
eye nàwɔ kadodo ƒe tete ɖe edzi ko dzi:hover
Tso Bootstrap 2 dzi la, CSS ƒe gbugbɔgaɖoɖo xoxoa trɔ zu nusiwo tso Normalize.css , dɔ si Nicolas Gallagher wɔ si hã naa ŋusẽ HTML5 Boilerplate la ŋudɔ .
Woateŋu akpɔ tɔtrɔ yeyea le reset.less me kokoko , gake woɖe nu geɖewo ɖa hena kpuie kple nyateƒetoto.
Grid ɖoɖo si woɖo ɖi si wona le Bootstrap me zãa sɔti 12 siwo ɖea egɔme le kekeme si nye 724px, 940px (si woɖo ɖi CSS si ɖoa nya ŋu mele eme o), kple 1170px. Le 767px ƒe nukpɔkpɔwo te la, sɔtiawo zua tsi eye woƒoa ƒu ɖe tsitrenu.
- <div klass = "fli" >
- <div ƒe hatsotso = "span4" > ... </div>
- <div ƒe hatsotso = "span8" > ... </div>
- </div> ƒe nyawo
Abe alesi woɖee fia le afisia ene la, woateŋu awɔ ɖoɖo vevi aɖe kple "sɔti" eve, ɖesiaɖe akeke gɔmeɖoanyi sɔti 12 siwo míeɖe gɔme abe míaƒe grid ɖoɖoa ƒe akpa aɖe ene la ƒe xexlẽme aɖe dzi.
- <div klass = "fli" >
- <div ƒe hatsotso = "span4" > ... </div>
- <div klass = "span4 ƒe vovototo4" > ... </div>
- </div> ƒe nyawo
Le static (non-fluid) grid system le Bootstrap me la, nesting le bɔbɔe. Be nàtsɔ wò nyatakakawo aɖo atɔ me la, ɖeko nàtsɔ sɔti yeye .row
kple ƒuƒoƒo aɖe akpe ɖe .span*
sɔti si li xoxo .span*
ŋu.
Ele be fli siwo wotsɔ ƒo ƒui la nanye sɔtiwo ƒe ƒuƒoƒo si ƒo ƒu ɖe sɔtiwo ƒe xexlẽme si le edzila ŋu. .span3
Le kpɔɖeŋu me, ele be woatsɔ sɔti eve siwo wotsɔ ƒo ƒui la ade .span6
.
- <div klass = "fli" >
- <div ƒe hatsotso = "span6" >
- Dzidzenu 1 ƒe sɔti
- <div klass = "fli" >
- <div klass = "span3" > Dzidzenu 2 </div>
- <div klass = "span3" > Dzidzenu 2 </div>
- </div> ƒe nyawo
- </div> ƒe nyawo
- </div> ƒe nyawo
Fluid grid ɖoɖoa zãa alafa memamãwo na sɔtiwo ƒe kekeme ɖe piksel siwo woɖo ɖi teƒe. Eƒe ŋuɖoɖo ƒe tɔtrɔwo hã le esi abe míaƒe fixed grid system ene, si kpɔa egbɔ be agbɔsɔsɔme si sɔ na key screen resolutions kple mɔ̃wo.
Na fli ɖesiaɖe nanye tsi to tɔtrɔ .row
ɖe .row-fluid
. Sɔtiawo nɔa nenema tututu, si wɔnɛ be wònɔa bɔbɔe ŋutɔ be woatrɔ ɖe ɖoɖo siwo woɖo ɖe ɖoɖo nu kple esiwo me tsi le dome.
- <div klass = "fli-tsi" >
- <div ƒe hatsotso = "span4" > ... </div>
- <div ƒe hatsotso = "span8" > ... </div>
- </div> ƒe nyawo
Nesting kple fluid grids to vovo vie: mehiã be nested columns ƒe xexlẽme nasɔ kple dzila o. Ke boŋ, wogbugbɔ ɖoa wò sɔtiwo ɖe ɖoɖo ɖesiaɖe dzi elabena fli ɖesiaɖe xɔa dzila ƒe sɔti la ƒe 100%.
- <div klass = "fli-tsi" >
- <div ƒe hatsotso = "span12" >
- Dzidzenu 1 lia le sɔti me
- <div klass = "fli-tsi" >
- <div klass = "span6" > Dzidzenu 2 </div>
- <div klass = "span6" > Dzidzenu 2 </div>
- </div> ƒe nyawo
- </div> ƒe nyawo
- </div> ƒe nyawo
Nusiwo trɔna | Asixɔxɔ si woɖo ɖi | Nuɖᴐɖᴐ |
---|---|---|
@gridColumns |
12. 12 | Sɔtiwo ƒe xexlẽme |
@gridColumnWidth |
60px ƒe didime | Sɔti ɖesiaɖe ƒe kekeme |
@gridGutterWidth |
20px ƒe didime | Teƒe manyomanyo le sɔtiwo dome |
Wotu ɖe Bootstrap me nye tɔtrɔ ʋɛ aɖewo hena asitɔtrɔ le 940px grid ɖoɖo si woɖo ɖi ŋu, si woŋlɔ ɖe etame. Wodzraa tɔtrɔwo katã na grid la ɖo ɖe tɔtrɔwo me.less.
Trɔtrɔ le grid la ŋu fia be woatrɔ tɔtrɔ etɔ̃awo @grid*
eye woagbugbɔ aƒo Bootstrap nu ƒu. Trɔ grid ƒe tɔtrɔwo le variables.less me eye nàzã mɔ ene siwo woŋlɔ ɖi la dometɔ ɖeka atsɔ agbugbɔ aƒo ƒui . Ne èle sɔti bubuwo kpem ɖe eŋu la, kpɔ egbɔ be yetsɔ CSS kpe ɖe eŋu na amesiwo le grid.less me.
Grid la ƒe tɔtrɔwɔwɔ wɔa dɔ le ɖoɖo si woɖo ɖi, 940px grid la ko dzi. Be nàlé Bootstrap ƒe akpa siwo ɖoa nya ŋu la me ɖe asi la, ahiã be nàtrɔ asi le gridsawo hã ŋu le responsive.less me.
940px-kekeme, si le titina ƒe ɖoɖo si woɖo ɖi eye wòle bɔbɔe na nyatakakadzraɖoƒe alo axa ɖesiaɖe kloe si ame ɖeka na <div class="container">
.
- <ŋutilã>
- <div klass = "nugoe" >
- ...
- </div> ƒe nyawo
- </body>
<div class="container-fluid">
na axa ƒe ɖoɖo si te ŋu trɔna, min- kple max-kekeme, kple miame ƒe axadzinu. Enyo ŋutɔ na apps kple docs.
- <div class = "nugoe-tsi" >
- <div klass = "fli-tsi" >
- <div ƒe hatsotso = "span2" >
- <!--Axadzinuŋɔŋlɔwo-->
- </div> ƒe nyawo
- <div ƒe hatsotso = "span10" >
- <!--Ŋutilã me nyawo-->
- </div> ƒe nyawo
- </div> ƒe nyawo
- </div> ƒe nyawo
Media biabia ɖe mɔ ɖe CSS tɔxɛ ŋu si wotu ɖe nɔnɔme geɖe dzi—dzidzemewo, kekemewo, ɖeɖefia ƒomevi, kple bubuawo—gake zi geɖe la, woƒe susu nɔa nu ŋu ƒo xlã min-width
kple max-width
.
Zã nyadzɔdzɔgblɔmɔnuwo ƒe nyabiasewo le agbanɔamedzi me eye wòanye gɔmedzedze na wò asitelefon dzi nyaselawo ko. Le dɔ gãwo gome la, wɔ bu kɔda gɔmeɖoanyi siwo woɖo ɖi ŋu ke menye nyadzɔdzɔgblɔmɔnuwo ƒe nyabiasewo ƒe ƒuƒoƒowo o.
Bootstrap doa alɔ media biabia ʋee aɖewo le faɛl ɖeka me be wòakpe ɖe ŋuwò nàna wò dɔwo nasɔ nyuie wu le mɔ̃ vovovowo kple screen ƒe nɔnɔmewo dzi. Nusiwo le emee nye esi:
Nuŋutigbalẽ | Ðoɖowɔɖi ƒe kekeme | Sɔti ƒe kekeme | Gutter ƒe kekeme |
---|---|---|---|
Smartphonewo ƒe asitelefonwo | 480px kple esiwo le ete | Sɔti siwo me tsi le, kekeme siwo woɖo ɖi mele wo ŋu o | |
Smartphonewo yi tablɛtwo dzi | 767px kple esiwo le ete | Sɔti siwo me tsi le, kekeme siwo woɖo ɖi mele wo ŋu o | |
Nɔnɔmetatawo ƒe kpe gbadzɛwo | 768px kple esiwo wu nenema | 42px ƒe didime | 20px ƒe didime |
Gᴐmedzeƒe | 980px kple edzivɔ | 60px ƒe didime | 20px ƒe didime |
Nukpɔkpɔ gã aɖe | 1200px kple edzivɔ | 70px ƒe didime | 30px ƒe didime |
Be nàkpɔ egbɔ be mɔ̃wo ɖe axa siwo ɖoa nya ŋu nyuie la, tsɔ viewport meta tag la de eme.
- <meta ŋkɔ = "nukpɔƒe" emenyawo = "kekeme=mɔ̃-kekeme, gɔmedzedze-dzidzenu=1.0" >
Bootstrap metsɔa media biabia siawo dea eme le eɖokui si o, gake wo gɔmesese kple wo tsɔtsɔ kpee le bɔbɔe ŋutɔ eye ebia ɖoɖo sue aɖe ko. Tiatia ʋee aɖewo le asiwò nàtsɔ ade Bootstrap ƒe ŋuɖoɖo ƒe nɔnɔmewo eme:
Nukata màtsɔe ade eme ko oa? Ne míagblɔe tututu la, menye nusianue wòle be wòawɔ nu ɖe ame ŋu nyuie o. Le esi teƒe be míade dzi ƒo na dɔwɔlawo be woaɖe nɔnɔme sia ɖa la, míebu eŋu be anyo wu be míawɔe wòawɔ dɔ.
- /* Anyigba ƒe nɔnɔme telefonwo kple anyime */
- @media ( max - kekeme : 480px ) { ... }.
- /* Anyigba ƒe nɔnɔme telefon na nɔnɔmetata tablɛt */
- @media ( max - kekeme : 767px ) { ... }.
- /* Nɔnɔmetata ƒe tablɛt yi anyigba ƒe nɔnɔme kple kplɔ̃dzivɔ dzi */
- @media ( min - kekeme : 768px ) kple ( max - kekeme : 979px ) { ... }.
- /* Dɔwɔkplɔ̃ gã aɖe */
- @media ( min - kekeme : 1200px ) { ... }.
For faster mobile-friendly development, use these basic utility classes for showing and hiding content by device.
Use on a limited basis and avoid creating entirely different versions of the same site. Instead, use them to complement each device's presentation.
For example, you might show a <select>
element for nav on mobile layouts, but not on tablets or desktops.
Shown here is a table of the classes we support and their effect on a given media query layout (labeled by device). They can be found in responsive.less
.
Class | Phones 480px and below | Tablets 767px and below | Desktops 768px and above |
---|---|---|---|
.visible-phone |
Visible | Hidden | Hidden |
.visible-tablet |
Hidden | Visible | Hidden |
.visible-desktop |
Hidden | Hidden | Visible |
.hidden-phone |
Hidden | Visible | Visible |
.hidden-tablet |
Visible | Hidden | Visible |
.hidden-desktop |
Visible | Visible | Hidden |
Resize your browser or load on different devices to test the above classes.
Green checkmarks indicate that class is visible in your current viewport.
Le afisia la, dzesi damawo fia be klass la ɣla ɖe wò nukpɔkpɔƒe si nèle fifia me.