Bootstrap hi responsive 12-column grid, layout leh component hrang hrang hmanga siam a ni.
Bootstrap hian HTML element thenkhat leh CSS property thenkhat HTML5 doctype hman ngai te a hmang thin. I project zawng zawng tan tirh lamah telh vek rawh.
- <!DOCTYPE html> tih a ni
- <html lang = "en" > tih hi a ni
- ...
- </html> tih a ni
Bootstrap hian global display, typography leh link style hrang hrangte a set a. A bik takin, kan:
margin
Taksa chungah chuan la chhuak rawhbackground-color: white;
a nibody
@baseFontFamily
te @baseFontSize
hmang rawh@baseLineHeight
@linkColor
link underlines chauh on rawh:hover
Heng style te hi scaffolding chhungah hmuh theih a ni.less .
Bootstrap 2 hmang hian reset block hlui chu Normalize.css duhsak turin paih a ni a, hei hi Nicolas Gallagher leh Jonathan Neal te project niin HTML5 Boilerplate pawh a tichak a ni. Kan reset.less chhungah Normalize tam tak kan hman laiin , Bootstrap atan bik element thenkhat kan paih chhuak a ni.
Default Bootstrap grid system hian column 12 a hmang a, chu chuan 940px wide container a siam a, responsive features enabled a ni lo. Responsive CSS file dah belh a nih chuan grid chu i viewport a zirin 724px leh 1170px wide-ah a insiamrem thei a ni. 767px viewport hnuaiah chuan column te chu fluid takin an inzawm a, vertical takin an stack thin.
Column pahnih layout awlsam tak atan chuan a siam la, column .row
zat tur dik tak add rawh .span*
. Hei hi column 12 awmna grid a nih avangin, chu column 12 zinga pakhat zel chuan .span*
a huam vek a, row tin atan (a nih loh leh parent-a column awm zat) 12 thleng a belh fo tur a ni.
- <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
He entirnan hi kan pe a, kan nei a, kan nei .span4
a .span8
, total column 12 leh row kimchang tak siam a ni.
.offset*
Class hmangin column te chu dinglamah sawn rawh . Class tin hian column pakhat veilam margin chu column pum puiin an tipung a. Entirnan, column pali chungah .offset4
a kal thei..span4
- <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
Default grid hmanga i content nest tur chuan column awmsa chhungah column thar .row
leh set dah la . Nested row-ah hian a parent-a column awm zat zat belhkhawm tur column set a awm tur a ni..span*
.span*
- <div class = "row" > tih hi a ni
- <div class = "span9" > tih hi a ni
- Level 1 ah a awm a
- <div class = "row" > tih hi a ni
- <div class = "span6" > Level 2 </div> 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 column zau zawng atan pixels ai chuan percentage a hmang zawk a ni. Kan fixed grid system ang bawka responsive theihna a nei a, key screen resolution leh device-te tan proportion dik tak a siamsak a ni.
Row eng pawh "fluid" siam la .row
, .row-fluid
. Column class te chu a inang chiah chiah a, fixed leh fluid grid inkara flip awlsam tak 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
Fixed grid system offsetting ang bawkin a thawk a: .offset*
column eng pawhah add la, chutiang column tam tak chuan offset rawh.
- <div class = "row-a tui" > tih 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
Fluid grids te hian nesting hi an hmang hrang hrang a: column nested level tin hian column 12 thleng an belh tur a ni. Hei hi a chhan chu fluid grid hian width setting atan pixels ni lovin percentage a hmang a ni.
- <div class = "row-a tui" > tih a ni
- <div class = "span12" > tih hi a ni
- Fluid 12 a ni
- <div class = "row-a tui" > tih a ni
- <div class = "span6" > tih hi a ni
- Tuihnai 6.
- <div class = "row-a tui" > tih a ni
- A rilru a buai em em a, a rilru a hah em em bawk a . 6 < / div >
- A rilru a buai em em a, a rilru a hah em em bawk a . 6 < / div >
- </div> tih a ni
- </div> tih a ni
- A rilru a buai em em a, a rilru a hah em em bawk a . 6 < / div >
- </div> tih a ni
- </div> tih a ni
- </div> tih a ni
Common fixed-width (leh optionally responsive) layout a pe a, a <div class="container">
mamawh chauh a pe bawk.
- <taksa> tih a ni
- <div class = "container" > tih hi a ni
- ...
- </div> tih a ni
- </body> tih a ni
Fluid, two-column page siam la, <div class="container-fluid">
—application 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
I project ah hian responsive CSS on la, <head>
i document chhungah meta tag dik tak leh stylesheet dang dah belh rawh. Customize page atanga Bootstrap i compile tawh chuan meta tag chauh i dah tel a ngai a ni.
- <meta hming = "viewport" content = "a zau zawng=device-a zau zawng, initial-scale=1.0" >
- <link href = "assets/css/bootstrap-responsive.css" rel = "stylesheet" >
Lu a ti sang a!Bootstrap hian tun dinhmunah hian default-in responsive features a dah lo a, engkim hi responsive a ngai lo. Developer te chu he feature hi paih chhuak tura fuih ai chuan a tul angin enable mai mai hi kan ngaihtuah tha ber.
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 |
---|---|---|---|
Display lian tak a ni | 1200px leh a chung lam a ni | 70px a ni | 30px a ni |
Hlawhchhamna | 980px leh a chung lam a ni | 60px a ni | 20px a ni |
Portrait tablet te pawh a awm bawk | 768px leh a chunglam a ni | 42px a ni | 20px a ni |
Phone atanga tablet thleng | 767px leh a hnuai lam a ni | Fluid column, a zau zawng fixed a awm lo | |
Phone te pawh a awm | 480px leh a hnuai lam a ni | Fluid column, a zau zawng fixed a awm lo |
- /* Desktop lian tak */ .
- @media ( min - a zau zawng : 1200px ) { ... }
- /* Portrait tablet atanga landscape leh desktop ah */
- @media ( min - width : 768px ) leh ( max - width : 979px ) { ... }
- /* Landscape phone atanga portrait tablet ah */
- @media ( max - width : 767px ) { ... } a ni.
- /* Landscape phone leh a hnuai lam */
- @media ( max - width : 480px ) { ... } a ni.
Mobile-friendly development chak zawk neih nan heng utility class te hi device hrang hranga content entir leh thup nan hmang la. A hnuaia tarlan te hi class awmsa leh media query layout pek (device hmanga label) a an nghawng dan table a ni. Anni chu responsive.less
.
Pawl | Phone te pawh a awm767px leh a hnuai lam a ni | Tablet te pawh a awm979px atanga 768px thleng a ni | Desktop te pawh a awmHlawhchhamna |
---|---|---|---|
.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 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. Responsive utilities hi table nen hman loh tur a ni a, chutiang a nih avang chuan support a ni lo.
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.