Bootstrap hi responsive 12-column grid hmanga siam a ni. Chu system hmanga fixed- leh fluid-width layout te pawh kan dah tel bawk.
Bootstrap hian HTML element leh CSS property te a hmang a, chu chu HTML5 doctype hman a ngai a ni. I project a Bootstrapped page zawng zawng bul tannaah hian dah tel ngei ang che.
- <!DOCTYPE html> tih a ni
- <html lang = "en" > tih hi a ni
- ...
- </html> tih a ni
Scaffolding.less file chhungah hian basic global display, typography leh link style te kan set a. A bik takin, kan:
background-color: white;
a nibody
@baseFontFamily
te @baseFontSize
hmang ang che@baseLineHeight
@linkColor
link underlines chauh on rawh:hover
Bootstrap 2 atang khan, traditional CSS reset chu a lo thang chho zel a, Normalize.css atanga elements te hmangin a lo thang chho zel a , Nicolas Gallagher project a ni a, HTML5 Boilerplate pawh a tichak bawk.
Reset thar hi reset.less ah hmuh theih a la ni a , mahse a tawi leh dik zawk nan element tam tak paih chhuah a ni.
Bootstrap-a default grid system pek hian column 12 a hmang a, chu chu 724px, 940px (responsive CSS tel lovin default), leh 1170px-a zau zawnga render out a ni. 767px viewport hnuaiah chuan column te chu fluid takin an inzawm a, vertical takin an stack thin.
- <div class = "row" > tih hi a ni
- <div class = "span4" > ... </div> tih hi a ni
- <div class = "span8" > ... </div> tih hi a ni
- </div> tih a ni
Heta kan hmuh ang hian, "column" pahnih hmangin basic layout siam theih a ni a, pakhat zel hian kan grid system-a kan tarlan foundational column 12 zinga engemaw zat a huam a ni.
- <div class = "row" > tih hi a ni
- <div class = "span4" > ... </div> tih hi a ni
- A rilru a buai em em a, a rilru a hah em em bawk a. > ... </ div >
- </div> tih a ni
Bootstrap-a static (non-fluid) grid system hmang hian nesting a awlsam hle. I content nest tur chuan column awmsa chhungah column thar .row
leh set dah mai rawh..span*
.span*
Nested rows ah hian column set a awm tur a ni a, chu chu a parent column awm zat a belhkhawm tur a ni. Entirnan, nested .span3
column pahnih chu a chhungah dah tur a .span6
ni.
- <div class = "row" > tih hi a ni
- <div class = "span6" > tih hi a ni
- Level 1 ah a awm a
- <div class = "row" > tih hi a ni
- < div class = "span3" > Level 2 ah hian a awm a
- < div class = "span3" > Level 2 ah hian a awm a
- </div> tih a ni
- </div> tih a ni
- </div> tih a ni
Fluid grid system hian fixed pixels ai chuan column zau zawng atan percentage a hmang zawk a ni. Kan fixed grid system ang bawka responsive variation a nei bawk a, key screen resolution leh device-te tan proportion dik tak a siamsak bawk.
Row eng pawh .row
chu .row-fluid
. Column te chu a inang chiah chiah a, fixed leh fluid layout inkara flip chu super straightforward a ni.
- <div class = "row-a tui" > tih a ni
- <div class = "span4" > ... </div> tih hi a ni
- <div class = "span8" > ... </div> tih hi a ni
- </div> tih a ni
Fluid grids hmanga nesting hi a danglam deuh hlek a: nested column awm zat hi parent nen a inmil a ngai lo. Chu ai chuan i column te chu level tin ah reset a ni a, a chhan chu row tin hian parent column 100% a lak avangin.
- <div class = "row-a tui" > tih a ni
- <div class = "span12" > tih hi a ni
- Level 1 a awm a
- <div class = "row-a tui" > tih a ni
- <div class = "span6" > Level 2 </div> ah hian a awm a
- <div class = "span6" > Level 2 </div> ah hian a awm a
- </div> tih a ni
- </div> tih a ni
- </div> tih a ni
A danglam thei | Default value a ni | Hrilhfiahna |
---|---|---|
@gridColumns |
12 a ni | Column awm zat |
@gridColumnWidth |
60px a ni | Column tin zau zawng |
@gridGutterWidth |
20px a ni | Column inkar ah negative space a awm |
Bootstrap chhungah hian default 940px grid system siam dan tur variable tlemte dah a ni a, a chungah hian kan ziak tawh a ni. Grid atana variable zawng zawng chu variable.less ah dah vek a ni.
Grid siam danglam tih awmzia chu @grid*
variable pathum thlak danglam leh Bootstrap recompiling tihna a ni. Grid variable te chu variable.less ah thlak la , recompile tur kawng pali documented zinga pakhat hmang rawh . Column dang i dah belh dawn a nih chuan grid.less-a awmte tan CSS kha add ngei ang che.
Grid customization hian default level, 940px grid ah chauh a thawk thei. Bootstrap a responsive aspects te maintain tur chuan responsive.less ah grids te pawh i customize a ngai bawk ang.
Default leh simple 940px-wide, centered layout chu website emaw page emaw pakhat chauh pek chhuah tan chauh a <div class="container">
ni .
- <taksa> tih a ni
- <div class = "container" > tih hi a ni
- ...
- </div> tih a ni
- </body> tih a ni
<div class="container-fluid">
page structure flexible tak, min- leh max-width te a pe a, veilam sidebar a pe bawk. Apps leh docs atan a tha hle.
- <div class = "container-a tui" > tih a ni
- <div class = "row-a tui" > tih a ni
- <div class = "span2" > tih hi a ni
- <!--Sidebar chhunga thu awmte-->
- </div> tih a ni
- <div class = "span10" > tih hi a ni
- <!--Taksa chhunga thil awmte-->
- </div> tih a ni
- </div> tih a ni
- </div> tih a ni
Media query hian condition engemaw zat—ratios, widths, display type, etc—a innghat custom CSS a phal a, mahse a tlangpuiin min-width
leh max-width
.
Media zawhnate chu mawhphurhna nei takin hmang la, i mobile audience-te tan bul tanna atan chauh hmang ang che. Project lian zawk tan chuan media query layer ni lovin dedicated code base ngaihtuah thin ang che.
Bootstrap hian file pakhatah media query tlemte a support a, hei hian i project te chu device hrang hrang leh screen resolution hrang hrangah a inmil zawk theih nan a pui thei a ni. Hetah hian a telte chu hetiang hi a ni:
Lehkhathem | Layout zau zawng | Column zau zawng | Gutter zau zawng |
---|---|---|---|
Smartphone te pawh a awm | 480px leh a hnuai lam a ni | Fluid column, a zau zawng fixed a awm lo | |
Smartphone atanga tablet thlenga hman theih a ni | 767px leh a hnuai lam a ni | Fluid column, a zau zawng fixed a awm lo | |
Portrait tablet te pawh a awm bawk | 768px leh a chunglam a ni | 42px a ni | 20px a ni |
Hlawhchhamna | 980px leh a chung lam a ni | 60px a ni | 20px a ni |
Display lian tak a ni | 1200px leh a chung lam a ni | 70px a ni | 30px a ni |
Device-te’n responsive page an lantir dik theih nan viewport meta tag kha dah tel bawk ang che.
- <meta hming = "viewport" content = "a zau zawng=device-a zau zawng, initial-scale=1.0" >
Bootstrap hian heng media query te hi automatic in a dah tel lo a, mahse hriatthiam leh add hi a awlsam hle a, setup tlem ber a ngai a ni. Bootstrap-a responsive features te dah tel theihna tur option tlemte i nei a:
Engvangin nge a telh mai loh vang? Thudik tak sawi ila, engkim hi chhanna pek a ngai lo. Developer te chu he feature hi paih chhuak tura fuih ai chuan enable hi kan ngaihtuah tha ber.
- /* Landscape phone leh a hnuai lam */
- @media ( max - width : 480px ) { ... } a ni.
- /* Landscape phone atanga portrait tablet ah */
- @media ( max - width : 767px ) { ... } a ni.
- /* Portrait tablet atanga landscape leh desktop ah */
- @media ( min - width : 768px ) leh ( max - width : 979px ) { ... }
- /* Desktop lian tak */ .
- @media ( min - a zau zawng : 1200px ) { ... }
Mobile-friendly development chak zawk neih nan heng basic utility class te hi device hrang hranga content entir leh thup nan hmang la.
A tlem berah hmang la, site khata version hrang hrang siam loh tur. Chu ai chuan, device tinte presentation tihpun nân hmang zâwk ang che.
Entirnan, <select>
mobile layout-ah nav atan element i entir thei a, mahse tablet emaw desktop emaw-ah erawh i entir lo.
Hetah hian kan support class te table leh media query layout pek tawh (device hmanga labeled) a an nghawng dan table tarlan a ni. Anni chu responsive.less
.
Pawl | Phone te pawh a awm480px leh a hnuai lam a ni | Tablet te pawh a awm767px leh a hnuai lam a ni | Desktop te pawh a awm768px leh a chunglam a ni |
---|---|---|---|
.visible-phone |
Hmuh theih | Thuhruk | Thuhruk |
.visible-tablet |
Thuhruk | Hmuh theih | Thuhruk |
.visible-desktop |
Thuhruk | Thuhruk | Hmuh theih |
.hidden-phone |
Thuhruk | Hmuh theih | Hmuh theih |
.hidden-tablet |
Hmuh theih | Thuhruk | Hmuh theih |
.hidden-desktop |
Hmuh theih | Hmuh theih | Thuhruk |
A chunga class te hi test turin i browser size thlak la, device hrang hrangah load rawh.
Green checkmarks hian i viewport hman mek ah hian class a lang tih a tarlang.
Hetah hian green checkmarks hian i viewport hman mek ah hian class a thup tih a tarlang a.