Nyob rau sab saum toj ntawm scaffolding, cov ntsiab lus HTML yooj yim yog styled thiab txhim kho nrog cov chav kawm txuas ntxiv los muab qhov tshiab, zoo ib yam thiab zoo li.
Tag nrho daim phiaj typographic yog raws li ob qhov sib txawv tsawg hauv peb cov ntaub ntawv variables.less: @baseFontSize
thiab@baseLineHeight
. Qhov thib ib yog lub hauv paus font-loj siv thoob plaws thiab qhov thib ob yog lub hauv paus kab-qhov siab.
Peb siv cov kev hloov pauv no, thiab qee qhov lej, los tsim cov npoo, paddings, thiab kab-qhov siab ntawm txhua hom thiab ntau dua.
Nullam quis risus eget urna mollis ornare vel eu leo. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nullam id dolor id nibh ultricies vehicula.
Ua ib kab lus sawv tawm los ntawm kev ntxiv .lead
.
Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Duis mollis, nws tsis yog commodo luctus.
Element | Kev siv | xaiv tau |
---|---|---|
<strong> |
Rau qhov tseem ceeb ntawm cov ntawv nyeem nrog qhov tseem ceeb | Tsis muaj |
<em> |
Rau qhov tseem ceeb ntawm cov ntawv nyeem nrog kev ntxhov siab | Tsis muaj |
<abbr> |
Wraps abbreviations thiab acronyms los qhia qhov nthuav version ntawm hover | Xws li xaiv tau .initialism cov chav kawm rau cov tsiaj ntawv loj. |
<address> |
Rau cov ntaub ntawv tiv tauj rau nws cov poj koob yawm txwv ze tshaj plaws lossis tag nrho lub cev ntawm kev ua haujlwm | Khaws formatting los ntawm xaus tag nrho cov kab nrog<br> |
Fusce dapibus , tellus ac cursus commodo , tortor mauris condimentum nibh , ut fermentum massa justo sit amet risus. Maecenas faucibus mollis interdum. Nulla vitae elit libero, pharetra auggue.
Nco tseg: Xav tias dawb siv <b>
thiab <i>
hauv HTML5, tab sis lawv cov kev siv tau hloov me ntsis. <b>
yog txhais tau hais tias tseem ceeb cov lus lossis kab lus yam tsis muaj qhov tseem ceeb ntxiv thaum <i>
feem ntau yog rau lub suab, cov lus qhia, thiab lwm yam.
Nov yog ob qho piv txwv ntawm yuav ua li cas <address>
siv tag:
Cov ntawv luv luv nrog tus title
cwj pwm muaj lub teeb dotted hauv qab ciam teb thiab tus cursor pab ntawm hover. Qhov no ua rau cov neeg siv ntxiv qhia tias ib yam dab tsi yuav tshwm sim ntawm hover.
Ntxiv cov initialism
chav kawm rau cov ntawv luv kom nce typographic sib haum xeeb los ntawm muab nws me me me me ntawv nyeem.
HTML yog qhov zoo tshaj plaws txij li lub khob cij hlais.
Lub ntsiab lus ntawm lo lus attribute yog attr .
Element | Kev siv | xaiv tau |
---|---|---|
<blockquote> |
Thaiv-theem keeb rau quoting cov ntsiab lus los ntawm lwm qhov chaw | Ntxiv .pull-left thiab .pull-right cov chav kawm rau kev xaiv floated |
<small> |
Cov txheej txheem xaiv tau ntxiv rau tus neeg siv cov lus qhia, feem ntau yog tus sau nrog lub npe ua haujlwm | Muab qhov chaw <cite> nyob ib ncig ntawm lub npe lossis lub npe ntawm qhov chaw |
Txhawm rau suav nrog blockquote, qhwv <blockquote>
ib ncig ntawm txhua HTML raws li qhov tsocai. Rau cov quotes ncaj peb pom zoo a <p>
.
suav nrog ib qho kev xaiv <small>
los hais txog koj qhov chaw thiab koj yuav tau txais em khiav —
ua ntej nws rau lub hom phiaj styling.
- <blockquote>
- <p> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante venenatis. </p>
- <small> Ib tug neeg nto moo </small>
- </blockquote>
Default blockquotes yog styled xws li:
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante venenatis.
Ib tug neeg nto moo hauv Lub Cev Ua Haujlwm
Txhawm rau ntab koj blockquote mus rau sab xis, ntxiv class="pull-right"
:
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante venenatis.
Ib tug neeg nto moo hauv Lub Cev Ua Haujlwm
<ul>
<ul class="unstyled">
<ol>
<dl>
<dl class="dl-horizontal">
Tau taub hau! Kab rov tav cov npe piav qhia yuav txiav cov ntsiab lus uas ntev dhau los ua kom haum rau sab laug kho text-overflow
. Nyob rau hauv nqaim viewports, lawv yuav hloov mus rau lub default stacked layout.
Qhwv inline snippet ntawm code nrog <code>
.
- Piv txwv li , <code> seem </ code > yuav tsum tau qhwv li inline .
Siv <pre>
rau ntau kab ntawm cov cai. Nco ntsoov khiav txhua lub kaum sab xis hauv cov cai rau kev ua kom raug.
<p>Simple text here...</p>
- <pre>
- <p>Sample text here...</p>
- </pre>
Nco tseg: Nco ntsoov khaws cov lej hauv<pre>
cov cim npe ze rau sab laug li sai tau; nws yuav muab tag nrho cov tabs.
Koj tuaj yeem xaiv ntxiv cov .pre-scrollable
chav kawm uas yuav teeb tsa max-qhov siab ntawm 350px thiab muab y-axis scrollbar.
Siv tib lub <pre>
ntsiab lus thiab ntxiv ob chav kawm xaiv rau kev ua kom zoo dua qub.
- <p> Sample text here... </p>
- <pre class = "prettyprint
- cov ntaub ntawv" >
- <p>Sample text here...</p>
- </pre>
Rub tawm google-code-prettify thiab saib readme rau kev siv.
Tag | Kev piav qhia |
---|---|
<table> |
Wrapping keeb los tso saib cov ntaub ntawv hauv hom ntawv tabular |
<thead> |
Cov khoom ntim rau lub rooj header kab ( <tr> ) rau cov ntawv sau cov kab lus |
<tbody> |
Thawv khoom rau kab kab ( <tr> ) nyob rau hauv lub cev ntawm lub rooj |
<tr> |
Thawv khoom rau ib pawg ntawm cov kab lus ( <td> lossis <th> ) uas tshwm ntawm ib kab |
<td> |
Default rooj cell |
<th> |
Cov lus tshwj xeeb ntawm tes rau kab (los yog kab, nyob ntawm seb thiab qhov chaw) cov ntawv yuav tsum tau siv nyob rau hauv a <thead> |
<caption> |
Cov lus piav qhia lossis cov ntsiab lus ntawm lub rooj tuav, tshwj xeeb tshaj yog muaj txiaj ntsig zoo rau cov neeg nyeem ntawv |
- <tab>
- <thead>
- <tr>
- <th> … </th>
- <th> … </th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td> … </td>
- <td> … </td>
- </tr>
- </tbody>
- </table>
Lub npe | Chav kawm | Kev piav qhia |
---|---|---|
Default | Tsis muaj | Tsis muaj style, tsuas yog kab thiab kab |
Basic | .table |
Tsuas yog kab rov tav kab ntawm kab |
Ciam teb | .table-bordered |
Hloov cov ces kaum thiab ntxiv cov ciam teb sab nraud |
Zebra-stripe | .table-striped |
Ntxiv lub teeb grey tom qab xim rau cov kab khib (1, 3, 5, thiab lwm yam) |
Condensed | .table-condensed |
Txiav ntsug padding nyob rau hauv ib nrab, los ntawm 8px mus rau 4px, nyob rau hauv tag nrho cov td thiab th cov ntsiab lus |
Cov ntxhuav tau cia li styled nrog tsuas yog ob peb ciam teb kom paub meej nyeem tau thiab tswj cov qauv. Nrog 2.0, .table
chav kawm yuav tsum.
- <table class = "table" >
- …
- </table>
# | Lub Npe | Lub Npe | Tus neeg siv lub npe |
---|---|---|---|
1 | Mark | Otto | @mdo |
2 | Yakhauj | Thornton | @fat |
3 | Larry | noog |
Tau txais me ntsis zoo nkauj nrog koj cov ntxhuav los ntawm kev ntxiv zebra-striping - tsuas yog ntxiv cov .table-striped
chav kawm.
Lus Cim: Cov kab kab kab siv :nth-child
CSS xaiv thiab tsis muaj nyob hauv IE7-IE8.
- <table class = "table table-striped" >
- …
- </table>
# | Lub Npe | Lub Npe | Tus neeg siv lub npe |
---|---|---|---|
1 | Mark | Otto | @mdo |
2 | Yakhauj | Thornton | @fat |
3 | Larry | noog |
Ntxiv ciam teb nyob ib ncig ntawm tag nrho cov rooj thiab cov ces kaum sib npaug rau lub hom phiaj zoo nkauj.
- <table class = "table table-bordered" >
- …
- </table>
# | Lub Npe | Lub Npe | Tus neeg siv lub npe |
---|---|---|---|
1 | Mark | Otto | @mdo |
Mark | Otto | @getbootstrap | |
2 | Yakhauj | Thornton | @fat |
3 | Larry noog |
Ua kom koj cov ntxhuav ntau dua los ntawm kev ntxiv cov .table-condensed
chav kawm los txiav cov lus cell padding hauv ib nrab (los ntawm 8px txog 4px).
- <table class = "table table-condensed" >
- …
- </table>
# | Lub Npe | Lub Npe | Tus neeg siv lub npe |
---|---|---|---|
1 | Mark | Otto | @mdo |
2 | Yakhauj | Thornton | @fat |
3 | Larry noog |
Xav tias dawb los ua ke ib qho ntawm cov chav kawm ntawv kom ua tiav qhov sib txawv los ntawm kev siv ib qho ntawm cov chav kawm muaj.
- <table class = "table table-striped table-bordered table-condensed" >
- ...
- </table>
Lub npe | |||
---|---|---|---|
# | Lub Npe | Lub Npe | Tus neeg siv lub npe |
1 | Mark | Otto | @mdo |
2 | Yakhauj | Thornton | @fat |
3 | Larry noog |
Qhov zoo tshaj plaws txog cov ntawv hauv Bootstrap yog tias tag nrho koj cov tswv yim thiab kev tswj hwm zoo li zoo txawm tias koj tsim lawv li cas hauv koj cov cim. Tsis xav tau HTML superfluous, tab sis peb muab cov qauv rau cov neeg xav tau.
Cov txheej txheem nyuaj dua tuaj nrog cov chav kawm succinct thiab scalable rau kev yooj yim styling thiab kev tshwm sim losis tswvyim dabtsi, yog li koj nyob nraum them ntawm txhua kauj ruam.
Bootstrap los nrog kev txhawb nqa rau plaub hom ntawv layouts:
Ntau hom kev layouts xav tau qee qhov kev hloov pauv rau kev kos npe, tab sis cov tswj lawv tus kheej nyob twj ywm thiab coj tus cwj pwm zoo ib yam.
Bootstrap cov ntaub ntawv suav nrog cov qauv rau txhua lub hauv paus daim ntawv tswj hwm xws li cov tswv yim, textarea, thiab xaiv koj xav tau. Tab sis nws kuj los nrog ib tug xov tooj ntawm kev cai Cheebtsam xws li appended thiab prepended inputs thiab txhawb rau cov npe ntawm checkboxes.
Cov xeev xws li kev ua yuam kev, ceeb toom, thiab kev ua tiav yog suav nrog rau txhua hom kev tswj xyuas daim ntawv. Kuj suav nrog yog cov qauv rau kev tswj tsis tau.
Bootstrap muab cov cim yooj yim thiab cov qauv rau plaub hom ntawm cov ntawv hauv web.
Lub npe | Chav kawm | Kev piav qhia |
---|---|---|
Vertical (default) | .form-vertical (tsis xav tau) |
Stacked, sab laug-aligned daim ntawv hla kev tswj |
Hauv kab | .form-inline |
Sab laug-aligned daim ntawv lo thiab inline-block tswj rau compact style |
Nrhiav | .form-search |
Ntxiv cov ntawv sau sib npaug rau kev tshawb nrhiav zoo nkauj |
Kab rov tav | .form-horizontal |
Float sab laug, txoj cai-txheej cov ntawv cim ntawm tib kab raws li kev tswj hwm |
Ntse thiab lub teeb yuag defaults yam tsis muaj ntxiv markup.
- <form class = "zoo" >
- <label> Label name </label>
- <input type = "text" class = "span3" placeholder = "Type something..." >
- <span class = "help-block" > Piv txwv block-level help text here. </span>
- <label class = "checkbox" >
- <input type = "checkbox" > Kos kuv tawm
- </label>
- <button type = "submit" class = "btn" > Xa </button>
- </form>
Ntxiv .form-search
rau daim ntawv thiab .search-query
mus rau input
.
- <form class = "zoo form-search" >
- <input type = "text" class = "input-medium search-query" >
- <button type = "submit" class = "btn" > Nrhiav </button>
- </form>
Ntxiv .form-inline
rau finesse txoj kab ntsug ntsug thiab sib nrug ntawm daim ntawv tswj.
- <form class = "zoo form-inline" >
- <input type = "text" class = "input-small" placeholder = "Email" >
- <input type = "password" class = "input-small" placeholder = "password" >
- <label class = "checkbox" >
- <input type = "checkbox" > Nco kuv
- </label>
- <button type = "submit" class = "btn" > Kos npe rau hauv </button>
- </form>
Pom ntawm sab xis yog tag nrho cov qauv kev tswj hwm peb txhawb nqa. Ntawm no yog daim ntawv teev npe:
Muab qhov piv txwv saum toj no daim ntawv layout, ntawm no yog cov cim txuam nrog thawj cov tswv yim thiab tswj pawg. Cov .control-group
, .control-label
, thiab .controls
cov chav kawm yog txhua yam xav tau rau styling.
- <form class = "form-horizontal" >
- <fieldset>
- <Legend> Lus dab neeg lus dab neeg </legend>
- <div class = "control-group" >
- <label class = "control-label" for = "input01" > Cov ntawv nkag teb chaws </label>
- <div class = "controls" >
- <input type = "text" class = "input-xlarge" id = "input01" >
- <p class = "help-block" > Txhawb kev pab ntawv </p>
- </div>
- </div>
- </fieldset>
- </form>
Bootstrap nta style rau browser-txhawb tsom thiab disabled
hais. Peb tshem tawm lub neej ntawd Webkit outline
thiab siv ib qho box-shadow
hauv nws qhov chaw rau :focus
.
Nws kuj suav nrog cov qauv kev lees paub rau qhov yuam kev, ceeb toom, thiab ua tiav. Txhawm rau siv, ntxiv cov chav kawm yuam kev rau ib puag ncig .control-group
.
- <fieldset
- class = "control-group yuam kev" >
- …
- </fieldset>
Cov pab pawg tawm tswv yim-nrog cov ntawv txuas ntxiv lossis cov ntawv sau ua ntej-muab txoj hauv kev yooj yim los muab cov ntsiab lus ntxiv rau koj cov tswv yim. Cov piv txwv zoo suav nrog @ kos npe rau Twitter usernames lossis $ rau nyiaj txiag.
Txog rau v1.4, Bootstrap yuav tsum tau kos npe ntxiv nyob ib ncig ntawm lub checkboxes thiab xov tooj cua los tso lawv. Tam sim no, nws yog ib qho teeb meem yooj yim ntawm kev rov ua dua qhov <label class="checkbox">
uas qhwv lub <input type="checkbox">
.
Inline checkboxes thiab xov tooj cua kuj tau txais kev txhawb nqa. Tsuas yog ntxiv .inline
rau ib qho .checkbox
lossis .radio
thiab koj ua tiav.
Txhawm rau siv prepend lossis append inputs nyob rau hauv ib daim ntawv inline, nco ntsoov muab tso .add-on
rau input
hauv tib kab, tsis muaj qhov chaw.
Txhawm rau ntxiv cov ntawv pab rau koj cov ntaub ntawv nkag, suav nrog cov ntawv pab hauv kab nrog <span class="help-inline">
lossis cov ntawv pab cuam thaiv nrog <p class="help-block">
tom qab lub ntsiab lus nkag.
Es tsis txhob ua txhua lub cim thov ntxiv, peb tau muab tso ua ke rau hauv sprite - ib pawg ntawm cov duab hauv ib cov ntaub ntawv uas siv CSS los tso cov duab nrog background-position
. Qhov no yog tib txoj kev uas peb siv hauv Twitter.com thiab nws tau ua haujlwm zoo rau peb.
Tag nrho cov chav kawm icons yog prefixed nrog .icon-
rau lub npe sib raug zoo thiab scope, zoo li peb lwm yam. Qhov no yuav pab kom tsis txhob muaj teeb meem nrog lwm cov cuab yeej.
Glyphicons tau tso cai rau peb siv Halflings teeb tsa hauv peb cov khoom siv qhib qhov chaw yog li peb muab qhov txuas thiab credit ntawm no hauv cov ntaub ntawv. Thov xav ua ib yam hauv koj qhov project.
Bootstrap siv lub <i>
cim rau tag nrho cov cim, tab sis lawv tsis muaj chav kawm ntawv-tsuas yog ib qho kev sib koom ua ntej. Txhawm rau siv, tso cov cai hauv qab no tsuas yog nyob txhua qhov chaw:
- <i class = "icon-search" ></i>
Kuj tseem muaj cov qauv muaj rau inverted (dawb) icons, npaj txhij nrog ib chav kawm ntxiv:
- <i class = "icon-search icon-white" ></i>
Muaj 140 chav kawm xaiv los ntawm koj lub cim. Tsuas yog ntxiv ib <i>
daim ntawv nrog cov chav kawm zoo thiab koj tau teeb tsa. Koj tuaj yeem pom cov npe tag nrho hauv sprites.less lossis nyob ntawm no hauv daim ntawv no.
Tau taub hau! Thaum siv ib sab ntawm cov hlua ntawm cov ntawv nyeem, xws li hauv cov nyees khawm lossis cov kev sib txuas nav, nco ntsoov tawm qhov chaw tom qab lub <i>
cim rau qhov sib nrug.
Icons zoo heev, tab sis qhov twg yuav siv lawv? Nov yog ob peb lub tswv yim:
Qhov tseem ceeb, txhua qhov chaw koj tuaj yeem tso <i>
tag, koj tuaj yeem tso lub cim.
Siv lawv nyob rau hauv cov nyees khawm, khawm pawg rau lub toolbar, navigation, los yog prepended daim ntawv inputs.