Bootstrap li ser torên 12-stûnî yên bersivdar, sêwiran, û hêmanan hatî çêkirin.
Bootstrap hin hêmanên HTML-ê û taybetmendiyên CSS-ê yên ku karanîna doctype HTML5 hewce dike bikar tîne. Di destpêka hemî projeyên xwe de wê têxin nav xwe.
- <!DOCTYPE html>
- <html lang = "ku" >
- ...
- </html>
Bootstrap pêşandana gerdûnî ya bingehîn, tîpografî, û şêwazên girêdanê destnîşan dike. Bi taybetî em:
margin
ser bedenê derxistinbackground-color: white;
li serbody
@baseFontFamily
, @baseFontSize
, û @baseLineHeight
taybetmendiyan wekî bingeha meya tîpografî bikar bînin@linkColor
bicîh bikin û binê zencîreyan tenê li ser bicîh bikin:hover
Ev şêwaz dikarin di nav îskeleyan de werin dîtin.kêm .
Bi Bootstrap 2-ê re, bloka nûvekirinê ya kevin di berjewendiya Normalize.css de hate avêtin , projeyek ji hêla Nicolas Gallagher û Jonathan Neal ve ku di heman demê de HTML5 Boilerplate jî hêzdar dike . Dema ku em pir ji Normalîzekirinê di nav reset.less xwe de bikar tînin , me hin hêman bi taybetî ji bo Bootstrap rakirin.
Pergala torê ya xwerû ya Bootstrap 12 stûnan bikar tîne , ku konteynirek fireh a 940 px bêyî çalakkirina taybetmendiyên bersivdar çêdike . Li gel pelê CSS-a bersivdar ku lê hatî zêdekirin, tora li gorî dîtina we 724px û 1170px fireh dibe. Li jêr dîmenderên 767 px, stûn herikbar dibin û ber bi vertîkalê ve disekinin.
Ji bo sêwirana du stûnên hêsan, a biafirînin .row
û jimareya guncan a .span*
stûnan lê zêde bikin. Ji ber ku ev tevnek 12-stûnî ye, her .span*
yek hejmarek ji wan 12 stûnan digire, û divê her gav ji bo her rêzek (an jî hejmara stûnên di dêûbavê de) 12 zêde bike.
- <div class = "rêz" >
- <div class = "span4" > ... </div>
- <div class = "span8" > ... </div>
- </div>
Bi vê nimûneyê re, me heye .span4
û .span8
, ji bo 12 stûnên tevahî û rêzek bêkêmasî çêbikin.
Bi karanîna dersan stûnan ber bi rastê ve .offset*
bigerînin. Her çîn marjîna çepê ya stûnekê bi tevahî stûnek zêde dike. Mînakî, .offset4
li .span4
ser çar stûnan digere.
- <div class = "rêz" >
- <div class = "span4" > ... </div>
- <div class = "span3 offset2" > ... </div>
- </div>
Ji bo ku hûn naveroka xwe bi tora xwerû re nehêlin, di nav stûnek heyî de stûnek nû .row
û komeke zêde bikin . Rêzên hêlînkirî divê komek stûnên ku li ser hejmara stûnên dêûbavê wê zêde dibin tê de bin..span*
.span*
- <div class = "rêz" >
- <div class = "span9" >
- Asta 1 stûn
- <div class = "rêz" >
- <div class = "span6" > Asta 2 </div>
- <div class = "span3" > Asta 2 </div>
- </div>
- </div>
- </div>
Pergala tora şilavê ji bo firehiyên stûnê li şûna pixelan ji sedî bikar tîne. Ew xwedî heman kapasîteyên bersivdayinê ye ku pergala meya torê ya sabît e, ji bo çareseriyên ekran û cîhazên sereke rêjeyên rast peyda dike.
Bi guherandina .row
li .row-fluid
. Dersên stûnê tam eynî dimînin, guheztina di navbera torên sabît û şikilî de hêsan dike.
- <div class = "row-fluid" >
- <div class="span4">...</div>
- <div class="span8">...</div>
- </div>
Operates the same way as the fixed grid system offsetting: add .offset*
to any column to offset by that many columns.
- <div class="row-fluid">
- <div class="span4">...</div>
- <div class="span4 offset2">...</div>
- </div>
Fluid grids utilize nesting differently: each nested level of columns should add up to 12 columns. This is because the fluid grid uses percentages, not pixels, for setting widths.
- <div class="row-fluid">
- <div class="span12">
- Fluid 12
- <div class="row-fluid">
- <div class="span6">
- Fluid 6
- <div class="row-fluid">
- <div class="span6">Fluid 6</div>
- <div class="span6">Fluid 6</div>
- </div>
- </div>
- <div class="span6">Fluid 6</div>
- </div>
- </div>
- </div>
Provides a common fixed-width (and optionally responsive) layout with only <div class="container">
required.
- <body>
- <div class="container">
- ...
- </div>
- </body>
Create a fluid, two-column page with <div class="container-fluid">
—great for applications and docs.
- <div class="container-fluid">
- <div class="row-fluid">
- <div class="span2">
- <!--Sidebar content-->
- </div>
- <div class="span10">
- <!--Body content-->
- </div>
- </div>
- </div>
Turn on responsive CSS in your project by including the proper meta tag and additional stylesheet within the <head>
of your document. If you've compiled Bootstrap from the Customize page, you need only include the meta tag.
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <link href="assets/css/bootstrap-responsive.css" rel="stylesheet">
Heads up! Bootstrap doesn't include responsive features by default at this time as not everything needs to be responsive. Instead of encouraging developers to remove this feature, we figure it best to enable it as needed.
Media queries allow for custom CSS based on a number of conditions—ratios, widths, display type, etc—but usually focuses around min-width
and max-width
.
Use media queries responsibly and only as a start to your mobile audiences. For larger projects, do consider dedicated code bases and not layers of media queries.
Bootstrap supports a handful of media queries in a single file to help make your projects more appropriate on different devices and screen resolutions. Here's what's included:
Label | Layout width | Column width | Gutter width |
---|---|---|---|
Large display | 1200px and up | 70px | 30px |
Default | 980px and up | 60px | 20px |
Portrait tablets | 768px and above | 42px | 20px |
Phones to tablets | 767px and below | Fluid columns, no fixed widths | |
Phones | 480px and below | Fluid columns, no fixed widths |
- /* Large desktop */
- @media (min-width: 1200px) { ... }
- /* Portrait tablet to landscape and desktop */
- @media (min-width: 768px) and (max-width: 979px) { ... }
- /* Landscape phone to portrait tablet */
- @media (max-width: 767px) { ... }
- /* Landscape phones and down */
- @media (max-width: 480px) { ... }
For faster mobile-friendly development, use these utility classes for showing and hiding content by device. Below is a table of the available classes and their effect on a given media query layout (labeled by device). They can be found in responsive.less
.
Class | Phones 767px and below | Tablets 979px to 768px | Desktops Default |
---|---|---|---|
.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 |
Use on a limited basis and avoid creating entirely different versions of the same site. Instead, use them to complement each device's presentation. Responsive utilities should not be used with tables, and as such are not supported.
Geroka xwe mezin bikin an li ser cîhazên cihêreng bar bikin da ku dersên jorîn ceribandin.
Nîşaneyên kesk destnîşan dikin ku çîn di dîmendera weya heyî de xuya ye.
Li vir, nîşaneyên kesk destnîşan dikin ku çîn di dîmendera weya heyî de veşartî ye.