CSS
Ntiaj teb no CSS teeb tsa, cov ntsiab lus HTML tseem ceeb styled thiab txhim kho nrog cov chav kawm txuas ntxiv, thiab cov kab sib chaws siab heev.
Ntiaj teb no CSS teeb tsa, cov ntsiab lus HTML tseem ceeb styled thiab txhim kho nrog cov chav kawm txuas ntxiv, thiab cov kab sib chaws siab heev.
Tau txais qhov qis qis ntawm cov khoom tseem ceeb ntawm Bootstrap cov txheej txheem, suav nrog peb txoj hauv kev kom zoo dua, nrawm dua, txhim kho lub vev xaib kom muaj zog.
Bootstrap ua rau siv qee cov ntsiab lus HTML thiab CSS cov khoom uas yuav tsum tau siv HTML5 doctype. suav nrog nws thaum pib ntawm tag nrho koj cov haujlwm.
Nrog Bootstrap 2, peb ntxiv cov kev xaiv mobile tus phooj ywg zoo rau qhov tseem ceeb ntawm lub moj khaum. Nrog Bootstrap 3, peb tau rov sau qhov project kom ua tus phooj ywg mobile txij thaum pib. Es tsis txhob ntxiv rau cov kev xaiv mobile, lawv tau ci rau hauv qhov tseem ceeb. Qhov tseeb, Bootstrap yog mobile ua ntej . Cov qauv txawb thawj zaug tuaj yeem pom thoob plaws hauv lub tsev qiv ntawv tag nrho tsis yog hauv cov ntaub ntawv cais.
Txhawm rau kom ua tiav qhov zoo thiab kov zooming, ntxiv qhov pom qhov pom meta tag rau koj <head>
.
Koj tuaj yeem lov tes taw lub peev xwm zooming ntawm cov khoom siv txawb los ntawm kev ntxiv user-scalable=no
rau qhov pom pom meta tag. Qhov no disables zooming, txhais tau hais tias cov neeg siv tsuas muaj peev xwm mus scroll, thiab ua rau koj qhov chaw zoo li me ntsis ntau dua li ib txwm daim ntawv thov. Zuag qhia tag nrho, peb tsis pom zoo qhov no rau txhua qhov chaw, yog li siv ceev faj!
Bootstrap teeb tsa lub ntiaj teb cov zaub, typography, thiab txuas cov qauv. Tshwj xeeb, peb:
background-color: #fff;
rau ntawmbody
@font-family-base
, @font-size-base
, thiab @line-height-base
cov cwj pwm ua peb lub hauv paus typographic@link-color
thiab siv qhov txuas hauv qab tsuas yog rau:hover
Cov style no tuaj yeem pom hauv scaffolding.less
.
Rau kev txhim kho tus ntoo khaub lig-browser rendering, peb siv Normalize.css , ib qhov project los ntawm Nicolas Gallagher thiab Jonathan Neal .
Bootstrap yuav tsum muaj cov khoom siv los qhwv cov ntsiab lus ntawm qhov chaw thiab tsev peb cov kab sib chaws. Koj tuaj yeem xaiv ib qho ntawm ob lub thawv los siv hauv koj cov haujlwm. Nco ntsoov tias, vim padding
thiab ntau dua, ob lub thawv tsis yog zesable.
Siv .container
rau lub teb ruaj ruaj ntim ntim.
Siv .container-fluid
rau lub thawv dav dav, hla tag nrho qhov dav ntawm koj qhov chaw saib.
Bootstrap suav nrog cov lus teb, mobile thawj cov kab sib chaws ua kua dej uas tsim nyog teev txog 12 kab raws li lub cuab yeej lossis qhov chaw saib qhov loj tuaj. Nws suav nrog cov chav kawm ua ntej rau kev xaiv layout yooj yim, nrog rau cov mixins muaj zog rau kev tsim ntau qhov kev sib txuas lus .
Grid systems yog siv los tsim cov nplooj ntawv layouts los ntawm cov kab thiab kab uas nyob hauv koj cov ntsiab lus. Nov yog yuav ua li cas Bootstrap grid system ua haujlwm:
.container
(taw-dav) lossis .container-fluid
(tag nrho-dav) rau kev sib dhos kom zoo thiab padding..row
thiab .col-xs-4
muaj rau kev ua cov phiaj xwm sai sai. Tsawg mixins kuj tuaj yeem siv rau ntau qhov layouts semantic.padding
. Qhov padding yog offset nyob rau hauv kab rau thawj thiab kawg kem ntawm qhov tsis zoo margin ntawm .row
s..col-xs-4
..col-md-*
chav kawm rau ib lub caij yuav tsis tsuas yog cuam tshuam rau nws cov styling ntawm cov khoom siv nruab nrab tab sis kuj ntawm cov khoom siv loj yog tias tsis muaj .col-lg-*
chav kawm.Saib rau cov piv txwv rau kev siv cov ntsiab cai no rau koj cov cai.
Peb siv cov lus nug hauv qab no hauv peb cov ntaub ntawv tsawg los tsim cov ntsiab lus tseem ceeb hauv peb cov kab sib chaws.
Peb qee zaus nthuav dav ntawm cov lus nug xov xwm no kom suav max-width
nrog txwv CSS rau cov khoom siv nqaim.
Saib seb yam ntawm Bootstrap kab sib chaws ua haujlwm li cas hla ntau yam khoom siv nrog lub rooj ua ke.
Cov khoom siv me me ntxiv Xov tooj (<768px) | Cov ntsiav tshuaj me me (≥768px) | Cov khoom siv nruab nrab Desktops (≥992px) | Cov khoom siv loj Desktops (≥1200px) | |
---|---|---|---|---|
Grid cwj pwm | Kab rov tav txhua lub sijhawm | Collapsed los pib, kab rov tav saum lub breakpoints | ||
Thawv dav | Tsis muaj (auto) | 7 50px | 9 70px | 1 170px |
Chav ua ntej | .col-xs- |
.col-sm- |
.col-md- |
.col-lg- |
# ntawm kab | 12 | |||
Kab dav | Auto | ~ 62 px | ~ 81 px | ~ 97 px |
Gutter dav | 30px (15px ntawm txhua sab ntawm kab) | |||
Nestable | Yog lawm | |||
Offsets | Yog lawm | |||
Kem xaj | Yog lawm |
Siv ib txheej ntawm .col-md-*
kab sib chaws, koj tuaj yeem tsim cov kab sib chaws yooj yim uas pib tawm ntawm cov khoom siv txawb thiab cov ntsiav tshuaj (qhov ntxiv me me rau me me) ua ntej ua kab rov tav ntawm desktop (nruab nrab) cov khoom siv. Muab kab kab kab rau hauv ib qho twg .row
.
Tig txhua qhov dav-dav-daim phiaj layout rau hauv qhov dav-dav layout los ntawm kev hloov koj sab nraud .container
mus rau .container-fluid
.
Tsis xav kom koj cov kab ke yooj yim hauv cov khoom siv me me? Siv cov chav kawm me me thiab nruab nrab cov khoom siv ntxiv los ntawm kev ntxiv .col-xs-*
.col-md-*
rau koj cov kab. Saib cov piv txwv hauv qab no kom paub ntau ntxiv txog qhov nws ua haujlwm li cas.
Ua raws li qhov piv txwv yav dhau los los ntawm kev tsim cov dynamic thiab muaj zog layouts nrog cov .col-sm-*
chav kawm ntsiav tshuaj.
Yog tias ntau tshaj 12 kab tau muab tso rau hauv ib kab, txhua pawg ntawm kab ntxiv yuav, raws li ib chav tsev, qhwv rau ib kab tshiab.
Nrog rau plaub theem ntawm daim phiaj muaj koj yuav tsum tau khiav mus rau hauv cov teeb meem qhov twg, ntawm qee qhov breakpoints, koj cov kab ntawv tsis meej heev vim tias ib qho siab dua lwm qhov. Txhawm rau kho qhov ntawd, siv qhov sib xyaw ua ke ntawm ib qho .clearfix
thiab peb cov chav kawm siv hluav taws xob ua haujlwm .
Ntxiv nrog rau kev tshem tawm kab ntawm cov ntsiab lus teb, koj yuav tsum tau rov pib dua offsets, thawb, lossis rub . Saib qhov no hauv kev nqis tes ua hauv daim phiaj piv txwv .
Txav cov kab mus rau sab xis siv .col-md-offset-*
cov chav kawm. Cov chav kawm no nce sab laug ntawm ib kab los ntawm *
kab. Piv txwv li, .col-md-offset-4
txav .col-md-4
dhau plaub kab.
Koj tseem tuaj yeem override offsets los ntawm cov kab qis qis nrog .col-*-offset-0
cov chav kawm.
Txhawm rau zes koj cov ntsiab lus nrog daim phiaj xwm txheej, ntxiv ib qho tshiab .row
thiab cov .col-sm-*
kab hauv kab uas twb muaj lawm .col-sm-*
. Nested kab yuav tsum muaj cov kab ke uas ntxiv txog 12 lossis tsawg dua (nws tsis tas yuav tsum tau siv tag nrho 12 kab muaj).
Yooj yim hloov qhov kev txiav txim ntawm peb cov kab sib txuas ua ke nrog .col-md-push-*
thiab .col-md-pull-*
hloov cov chav kawm.
Ntxiv rau cov chav kawm prebuilt grids rau cov layouts ceev, Bootstrap suav nrog Less variables thiab mixins kom sai tsim koj tus kheej yooj yim, semantic layouts.
Cov kev sib txawv txiav txim seb tus naj npawb ntawm kab, qhov dav ntawm lub qhov dej, thiab cov lus nug xov xwm ntawm qhov uas yuav pib cov kab ke. Peb siv cov no los tsim cov chav kawm ntawv teev tseg ua ntej sau tseg saum toj no, nrog rau cov kev cai mixins teev hauv qab no.
Mixins yog siv ua ke nrog cov kab sib chaws sib txawv los tsim cov CSS semantic rau ib tus kab sib chaws.
Koj tuaj yeem hloov kho qhov hloov pauv rau koj tus kheej cov txiaj ntsig kev cai, lossis tsuas yog siv cov mixins nrog lawv cov nqi qub. Ntawm no yog ib qho piv txwv ntawm kev siv lub neej ntawd teeb tsa los tsim ob kab layout nrog qhov sib txawv ntawm.
Tag nrho cov ntsiab lus HTML, <h1>
dhau los <h6>
, muaj. .h1
los ntawm .h6
cov chav kawm kuj muaj, rau thaum koj xav kom phim cov font styling ntawm ib nqe lus tab sis tseem xav kom koj cov ntawv tso tawm kom pom hauv kab.
h 1. Bootstrap taub hau |
ib 36px |
h 2. Bootstrap taub hau |
ib 30px |
h 3. Bootstrap taub hau |
ib 24px |
h 4. Bootstrap taub hau |
ib 18px |
h 5. Bootstrap taub hau |
ib 14px |
h 6. Bootstrap taub hau |
ib 12px |
Tsim cov ntawv sib dua, cov ntawv thib ob hauv txhua nqe lus nrog cov <small>
ntawv sau lossis cov .small
chav kawm.
h 1. Bootstrap heading Secondary text |
h 2. Bootstrap heading Secondary text |
h 3. Bootstrap heading Secondary text |
h 4. Bootstrap heading Secondary text |
h 5. Bootstrap heading Secondary text |
h 6. Bootstrap heading Secondary text |
Bootstrap lub ntiaj teb no default font-size
yog 14px , nrog ib tug line-height
ntawm 1.428 . Qhov no yog siv rau <body>
tag nrho cov kab lus. Tsis tas li ntawd, <p>
(cov kab lus) tau txais cov kab hauv qab ntawm ib nrab ntawm lawv cov kab-qhov siab (10px los ntawm lub neej ntawd).
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.
Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec ullamcorper nulla non metus auctor fringilla. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Donec ullamcorper nulla non metus auctor fringilla.
Maecenas sed diam eget risus varius blandit zaum amet tsis magna. Donec id elit non mi porta gravida at eget metus. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit.
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.
Qhov ntsuas typographic yog nyob ntawm ob qhov sib txawv tsawg dua hauv cov variables.less : @font-size-base
thiab @line-height-base
. Thawj 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 yooj yim los tsim cov npoo, paddings, thiab kab-qhov siab ntawm txhua yam peb hom thiab ntau dua. Customize lawv thiab Bootstrap adapts.
Rau qhov tseem ceeb ntawm cov ntawv sau vim nws qhov cuam tshuam hauv lwm cov ntsiab lus, siv lub <mark>
cim npe.
Koj tuaj yeem siv lub cim cim rautseem ceebntawv nyeem.
Txhawm rau qhia cov ntawv blocks uas tau muab tshem tawm siv lub <del>
cim npe.
Cov kab ntawv no yog txhais tau tias yuav raug kho raws li cov ntawv deleted.
Txhawm rau qhia cov ntawv blocks uas tsis muaj feem cuam tshuam siv lub <s>
cim npe.
Cov kab ntawv no txhais tau tias yuav raug kho raws li qhov tsis raug lawm.
Rau kev qhia ntxiv rau cov ntaub ntawv siv lub <ins>
cim npe.
Cov kab ntawv no yog txhais tau tias yuav raug kho raws li qhov ntxiv rau daim ntawv.
Txhawm rau kos kab ntawv siv lub <u>
cim.
Cov kab ntawv no yuav ua raws li hauv qab
Ua kom siv HTML's default emphasis tags nrog cov qauv hnyav.
Txhawm rau tshem tawm cov ntsiab lus hauv kab lossis thaiv cov ntawv, siv lub <small>
cim los teeb tsa cov ntawv ntawm 85% qhov loj ntawm niam txiv. Cov ntsiab lus tau txais lawv tus kheej font-size
rau cov ntsiab lus nested <small>
.
Koj tuaj yeem hloov pauv siv lub ntsiab lus inline nrog .small
rau qhov chaw <small>
.
Cov kab ntawv no yog txhais tau tias yuav tsum tau kho raws li kev luam zoo.
Rau kev hais txog ib qho snippet ntawm cov ntawv nrog hnyav font-qhov hnyav.
Cov snippet hauv qab no yog rendered ua bold text .
Rau kev hais txog ib ntu ntawm cov ntawv nrog italics.
Cov kab lus hauv qab no tau muab ua cov ntawv italicized .
Txaus siab rau siv <b>
thiab <i>
hauv HTML5. <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.
Yooj yim realign cov ntawv rau cov khoom nrog cov chav kawm ntawv nyeem.
Left aligned text.
Center aligned ntawv nyeem.
Txoj cai dlhos ntawv.
Cov ntawv tseeb.
Tsis qhwv ntawv.
Hloov cov ntawv hauv cov khoom nrog cov chav kawm ntawv sau ntawv.
Cov ntawv qis.
Uppercased ntawv nyeem.
Cov ntawv loj.
Stylized siv HTML lub <abbr>
ntsiab lus rau cov ntawv luv thiab cov ntawv sau los qhia qhov nthuav dav ntawm hover. Cov ntawv luv luv nrog tus title
cwj pwm muaj lub teeb pom hauv qab ciam teb thiab tus cursor pab ntawm hover, muab cov ntsiab lus ntxiv ntawm hover thiab rau cov neeg siv cov cuab yeej pab.
Lub ntsiab lus ntawm lo lus attribute yog attr .
Ntxiv .initialism
rau cov ntawv luv rau me me font-loj.
HTML yog qhov zoo tshaj plaws txij li lub khob cij hlais.
Muab cov ntaub ntawv tiv tauj tam sim no rau cov poj koob yawm txwv ze tshaj plaws lossis tag nrho lub cev ua haujlwm. Khaws formatting los ntawm kev xaus tag nrho cov kab nrog <br>
.
Rau quoting blocks ntawm cov ntsiab lus los ntawm lwm qhov chaw hauv koj cov ntaub ntawv.
Qhwv <blockquote>
ib ncig ntawm HTML raws li cov lus tsocai. Rau cov quotes ncaj, peb pom zoo ib <p>
.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat ante.
Cov qauv thiab cov ntsiab lus hloov pauv rau kev hloov pauv yooj yim ntawm tus qauv <blockquote>
.
Ntxiv <footer>
rau kev txheeb xyuas qhov chaw. Muab lub npe ntawm qhov chaw ua haujlwm hauv <cite>
.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat ante.
Ntxiv .blockquote-reverse
rau ib qho blockquote nrog cov ntsiab lus ncaj nraim.
Ib daim ntawv teev cov khoom uas qhov kev txiav txim tsis meej meej.
Ib daim ntawv teev cov khoom uas qhov kev txiav txim tsis meej.
Tshem tawm lub neej ntawd list-style
thiab sab laug ntawm cov npe khoom (cov me nyuam tam sim ntawd). Qhov no tsuas yog siv rau cov menyuam yaus tam sim ntawd sau cov khoom , txhais tau tias koj yuav tsum tau ntxiv cov chav kawm rau cov npe nested ib yam nkaus.
Muab tag nrho cov npe khoom rau ntawm ib kab nrog display: inline-block;
thiab qee lub teeb padding.
Ib daim ntawv teev cov ntsiab lus nrog lawv cov lus piav qhia.
Ua cov ntsiab lus thiab cov lus piav qhia nyob rau hauv <dl>
kab ntawm ib sab. Pib tawm stacked zoo li default <dl>
s, tab sis thaum lub navbar expands, ua li no.
Kab rov tav cov npe piav qhia yuav txiav cov ntsiab lus uas ntev dhau los kom haum rau hauv kab laug sab nrog text-overflow
. Nyob rau hauv nqaim viewports, lawv yuav hloov mus rau lub default stacked layout.
Qhwv inline snippet ntawm code nrog <code>
.
<section>
yuav tsum tau qhwv li inline.
Siv qhov <kbd>
taw qhia cov tswv yim uas feem ntau nkag los ntawm cov keyboard.
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>
Koj tuaj yeem xaiv ntxiv cov .pre-scrollable
chav kawm, uas yuav teeb tsa max-qhov siab ntawm 350px thiab muab y-axis scrollbar.
Txhawm rau qhia qhov hloov pauv siv lub <var>
cim.
y = m x + b
Rau kev qhia txog cov qauv tsim tawm los ntawm ib qho kev pab cuam siv lub <samp>
cim npe.
Cov ntawv no yog tsim los kho raws li cov qauv tso tawm los ntawm lub khoos phis tawj program.
Rau qhov yooj yim styling - lub teeb padding thiab tsuas yog kab rov tav dividers - ntxiv cov hauv paus chav kawm .table
rau ib qho twg <table>
. Tej zaum nws yuav zoo li tsis txaus ntseeg, tab sis muab kev siv dav dav ntawm cov ntxhuav rau lwm cov plugins xws li daim ntawv qhia hnub hli thiab cov hnub xaiv, peb tau xaiv cais peb cov kev cai cov lus.
# | Lub Npe | Lub Npe | Tus neeg siv lub npe |
---|---|---|---|
1 | Mark | Otto | @mdo |
2 | Yakhauj | Thornton | @fat |
3 | Larry | noog |
Siv .table-striped
los ntxiv zebra-striping rau ib kab lus hauv <tbody>
.
Cov ntxhuav striped yog styled ntawm :nth-child
CSS selector, uas tsis muaj nyob rau hauv Internet Explorer 8.
# | Lub Npe | Lub Npe | Tus neeg siv lub npe |
---|---|---|---|
1 | Mark | Otto | @mdo |
2 | Yakhauj | Thornton | @fat |
3 | Larry | noog |
Ntxiv .table-bordered
rau ciam teb rau txhua sab ntawm lub rooj thiab cov hlwb.
# | Lub Npe | Lub Npe | Tus neeg siv lub npe |
---|---|---|---|
1 | Mark | Otto | @mdo |
2 | Yakhauj | Thornton | @fat |
3 | Larry | noog |
Ntxiv .table-hover
los pab kom lub xeev hover ntawm cov kab lus hauv ib <tbody>
.
# | Lub Npe | Lub Npe | Tus neeg siv lub npe |
---|---|---|---|
1 | Mark | Otto | @mdo |
2 | Yakhauj | Thornton | @fat |
3 | Larry | noog |
Ntxiv .table-condensed
kom cov ntxhuav ntau compact los ntawm kev txiav cell padding nyob rau hauv ib nrab.
# | Lub Npe | Lub Npe | Tus neeg siv lub npe |
---|---|---|---|
1 | Mark | Otto | @mdo |
2 | Yakhauj | Thornton | @fat |
3 | Larry noog |
Siv cov chav kawm contextual rau xim kab kab los yog ib lub hlwb.
Chav kawm | Kev piav qhia |
---|---|
.active |
Siv cov xim hover rau ib kab lossis xovtooj |
.success |
Qhia tau tias muaj kev vam meej lossis zoo |
.info |
Qhia txog kev hloov pauv lossis kev nqis tes ua |
.warning |
Qhia ceeb toom uas yuav xav tau kev saib xyuas |
.danger |
Qhia txog qhov txaus ntshai lossis qhov ua tsis zoo |
# | Kab lus | Kab lus | Kab lus |
---|---|---|---|
1 | Kem ntsiab lus | Kem ntsiab lus | Kem ntsiab lus |
2 | Kem ntsiab lus | Kem ntsiab lus | Kem ntsiab lus |
3 | Kem ntsiab lus | Kem ntsiab lus | Kem ntsiab lus |
4 | Kem ntsiab lus | Kem ntsiab lus | Kem ntsiab lus |
5 | Kem ntsiab lus | Kem ntsiab lus | Kem ntsiab lus |
6 | Kem ntsiab lus | Kem ntsiab lus | Kem ntsiab lus |
7 | Kem ntsiab lus | Kem ntsiab lus | Kem ntsiab lus |
8 | Kem ntsiab lus | Kem ntsiab lus | Kem ntsiab lus |
9 | Kem ntsiab lus | Kem ntsiab lus | Kem ntsiab lus |
Siv cov xim los ntxiv lub ntsiab lus rau kab lus lossis ib lub xov tooj ntawm tes tsuas yog muab qhov pom kev pom, uas yuav tsis raug xa mus rau cov neeg siv khoom siv thev naus laus zis - xws li cov ntawv nyeem. Xyuas kom meej tias cov ntaub ntawv qhia los ntawm cov xim yog pom tseeb los ntawm cov ntsiab lus nws tus kheej (cov ntawv pom nyob rau hauv cov kab lus / cell), los yog suav nrog lwm txoj kev, xws li cov ntawv ntxiv zais nrog cov .sr-only
chav kawm.
Tsim cov lus teb los ntawm kev qhwv ib qho twg .table
los .table-responsive
ua kom lawv nqes kab rov tav ntawm cov khoom siv me me (hauv qab 768px). Thaum saib ntawm txhua yam loj dua 768px dav, koj yuav tsis pom qhov txawv ntawm cov ntxhuav no.
Cov lus teb ua rau siv overflow-y: hidden
, uas clips tawm cov ntsiab lus uas dhau mus rau hauv qab lossis sab saum toj ntawm lub rooj. Tshwj xeeb, qhov no tuaj yeem txiav tawm cov ntawv qhia zaub mov thiab lwm tus neeg thib peb widgets.
Firefox muaj qee qhov ua tau txawv txawv teb qhov kev width
xav uas cuam tshuam nrog lub rooj teb. Qhov no tsis tuaj yeem overridden yam tsis muaj Firefox tshwj xeeb hack uas peb tsis muab hauv Bootstrap:
Yog xav paub ntxiv, nyeem cov lus teb Stack Overflow .
# | Cov kab lus | Cov kab lus | Cov kab lus | Cov kab lus | Cov kab lus | Cov kab lus |
---|---|---|---|---|---|---|
1 | Rooj cell | Rooj cell | Rooj cell | Rooj cell | Rooj cell | Rooj cell |
2 | Rooj cell | Rooj cell | Rooj cell | Rooj cell | Rooj cell | Rooj cell |
3 | Rooj cell | Rooj cell | Rooj cell | Rooj cell | Rooj cell | Rooj cell |
# | Cov kab lus | Cov kab lus | Cov kab lus | Cov kab lus | Cov kab lus | Cov kab lus |
---|---|---|---|---|---|---|
1 | Rooj cell | Rooj cell | Rooj cell | Rooj cell | Rooj cell | Rooj cell |
2 | Rooj cell | Rooj cell | Rooj cell | Rooj cell | Rooj cell | Rooj cell |
3 | Rooj cell | Rooj cell | Rooj cell | Rooj cell | Rooj cell | Rooj cell |
Tus kheej daim ntawv tswj tau txais qee qhov qauv thoob ntiaj teb. Tag nrho cov ntawv nyeem <input>
, <textarea>
, thiab <select>
cov ntsiab lus nrog .form-control
raug teeb tsa los width: 100%;
ntawm lub neej ntawd. Qhwv daim ntawv lo thiab tswj .form-group
kom zoo tshaj qhov sib nrug.
Tsis txhob sib xyaw cov pab pawg ncaj qha nrog pab pawg nkag . Hloov chaw, zes pawg tswv yim sab hauv ntawm pawg ntawv.
Ntxiv .form-inline
rau koj daim ntawv (uas tsis tas yuav yog ib qho <form>
) rau sab laug-kho thiab inline-block tswj. Qhov no tsuas yog siv rau cov ntawv hauv cov chaw saib uas muaj tsawg kawg yog 768px dav.
Inputs thiab xaiv tau width: 100%;
siv los ntawm lub neej ntawd hauv Bootstrap. Nyob rau hauv cov ntaub ntawv inline, peb rov pib dua qhov width: auto;
ntawd kom ntau yam kev tswj hwm tuaj yeem nyob ntawm tib kab. Nyob ntawm koj qhov layout, ntxiv kev cai dav yuav xav tau.
Cov neeg nyeem ntawv yuav muaj teeb meem nrog koj cov ntawv yog tias koj tsis suav nrog daim ntawv lo rau txhua qhov kev tawm tswv yim. Rau cov ntaub ntawv hauv kab no, koj tuaj yeem nkaum cov ntawv lo siv cov .sr-only
chav kawm. Muaj lwm txoj hauv kev los muab ib daim ntawv lo rau cov cuab yeej pabcuam, xws li aria-label
, aria-labelledby
lossis title
tus cwj pwm. Yog tias tsis muaj ib qho ntawm cov no tam sim no, cov neeg siv tshuaj ntsuam tuaj yeem siv rau kev siv tus placeholder
cwj pwm, yog tias tam sim no, tab sis nco ntsoov tias kev siv placeholder
los hloov lwm txoj kev sau npe tsis raug qhia.
Siv Bootstrap cov chav kawm ntawv teev tseg ua ntej los kho cov ntawv sau thiab pab pawg ntawm cov ntawv tswj hauv kab rov tav los ntawm kev ntxiv .form-horizontal
rau daim ntawv (uas tsis tas yuav yog ib qho <form>
). Ua li ntawd hloov .form-group
s coj li kab kab sib chaws, yog li tsis xav tau .row
.
Piv txwv ntawm cov qauv kev tswj hwm kev txhawb nqa hauv ib qho piv txwv daim ntawv layout.
Feem ntau hom kev tswj, cov ntawv nyeem-raws li kev nkag teb chaws. Xws li kev txhawb nqa rau txhua hom HTML5: text
, password
, datetime
, datetime-local
, date
, , month
, time
, week
, number
, , email
, url
, search
, tel
, thiab color
.
Cov tswv yim yuav tsuas yog tag nrho styled yog tias lawv type
tau tshaj tawm kom raug.
Txhawm rau ntxiv cov ntawv sib xyaw lossis cov nyees khawm ua ntej thiab / lossis tom qab cov ntawv nyeem <input>
, kos tawm cov khoom siv hauv pawg .
Daim ntawv tswj uas txhawb nqa ntau cov kab ntawv. Hloov rows
tus cwj pwm raws li qhov tsim nyog.
Checkboxes yog xaiv ib lossis ntau txoj hauv kev hauv ib daim ntawv teev npe, thaum lub xov tooj cua yog xaiv ib qho kev xaiv los ntawm ntau.
Cov neeg xiam oob qhab checkboxes thiab xov tooj cua tau txais kev txhawb nqa, tab sis kom muab tus cursor "tsis tso cai" rau ntawm tus niam txiv hover <label>
, koj yuav tsum tau ntxiv cov .disabled
chav kawm rau niam txiv .radio
, .radio-inline
, .checkbox
, lossis .checkbox-inline
.
Siv cov ntawv .checkbox-inline
lossis .radio-inline
cov chav kawm ntawm cov ntawv txheeb lossis xov tooj cua rau kev tswj hwm uas tshwm sim ntawm tib kab.
Yog tias koj tsis muaj cov ntawv sau nyob rau hauv <label>
, cov tswv yim yog positioned raws li koj xav tau. Tam sim no tsuas yog ua haujlwm ntawm lub npov tsis-inline thiab xov tooj cua. Nco ntsoov tseem muab qee daim ntawv lo rau cov cuab yeej pabcuam (piv txwv li, siv aria-label
).
Nco ntsoov tias ntau haiv neeg xaiv cov ntawv qhia zaub mov - xws li hauv Safari thiab Chrome - muaj cov ces kaum uas tsis tuaj yeem hloov kho ntawm border-radius
cov khoom.
Rau <select>
kev tswj hwm nrog tus multiple
cwj pwm, ntau yam kev xaiv tau pom los ntawm lub neej ntawd.
Thaum koj yuav tsum tso cov ntawv dawb nyob ib sab ntawm daim ntawv lo rau hauv ib daim ntawv, siv cov .form-control-static
chav kawm ntawm a <p>
.
Peb tshem tawm cov outline
qauv qub ntawm qee daim ntawv tswj hwm thiab siv ib qho box-shadow
hauv nws qhov chaw rau :focus
.
:focus
xeevCov lus piv txwv saum toj no siv cov qauv kev cai hauv peb cov ntaub ntawv los ua kom pom lub :focus
xeev ntawm a .form-control
.
Ntxiv tus disabled
cwj pwm boolean ntawm cov tswv yim los tiv thaiv cov neeg siv kev sib cuam tshuam. Disabled inputs tshwm sib dua thiab ntxiv tus not-allowed
cursor.
Ntxiv tus disabled
cwj pwm rau ib qho <fieldset>
kom lov tes taw tag nrho cov tswj hauv <fieldset>
ib zaug.
<a>
Los ntawm lub neej ntawd, browsers yuav kho txhua hom kev tswj hwm ib txwm muaj ( <input>
, <select>
thiab <button>
cov ntsiab lus ) hauv qhov <fieldset disabled>
ua tsis taus, tiv thaiv ob qho tib si keyboard thiab nas cuam tshuam rau lawv. Txawm li cas los xij, yog tias koj daim ntawv tseem suav nrog <a ... class="btn btn-*">
cov ntsiab lus, cov no tsuas yog muab cov style ntawm pointer-events: none
. Raws li tau sau tseg hauv ntu hais txog cov neeg xiam oob qhab rau cov nyees khawm (thiab tshwj xeeb hauv ntu ntu rau cov khoom thauj tog rau nkoj), CSS cov cuab yeej no tseem tsis tau muaj tus qauv thiab tsis tau txais kev txhawb nqa tag nrho hauv Opera 18 thiab hauv qab no, lossis hauv Internet Explorer 11, thiab yeej. 'tsis tiv thaiv cov neeg siv keyboard los ntawm kev ua kom pom tseeb lossis qhib cov kev txuas no. Yog li kom muaj kev nyab xeeb, siv kev cai JavaScript los lov tes taw cov kev sib txuas.
Thaum Bootstrap yuav siv cov qauv no hauv txhua qhov browsers, Internet Explorer 11 thiab hauv qab no tsis txhawb nqa tus disabled
cwj pwm ntawm <fieldset>
. Siv kev cai JavaScript los lov tes taw cov fieldset hauv cov browsers no.
Ntxiv tus readonly
cwj pwm boolean ntawm ib qho kev tawm tswv yim los tiv thaiv kev hloov pauv ntawm cov tswv yim tus nqi. Cov ntawv nyeem nkaus xwb zoo li sib dua (ib yam li cov khoom siv tsis taus), tab sis khaws tus cursor tus qauv.
Thaiv qib pab ntawv nyeem rau daim ntawv tswj.
Cov ntawv nyeem yuav tsum qhia meej meej nrog rau daim ntawv tswj nws cuam tshuam nrog kev siv tus aria-describedby
cwj pwm. Qhov no yuav ua kom ntseeg tau tias cov thev naus laus zis pabcuam - xws li cov neeg nyeem tshuaj ntsuam - yuav tshaj tawm cov ntawv pabcuam no thaum tus neeg siv tsom lossis nkag mus rau kev tswj hwm.
Bootstrap suav nrog cov qauv kev lees paub rau kev ua yuam kev, ceeb toom, thiab kev ua tiav ntawm cov ntawv tswj hwm. Txhawm rau siv, ntxiv .has-warning
, .has-error
, lossis .has-success
rau cov khoom niam txiv. Ib qho .control-label
, .form-control
, thiab .help-block
hauv cov khoom ntawd yuav tau txais cov qauv kev lees paub.
Siv cov qauv kev siv tau no los qhia txog lub xeev ntawm daim ntawv tswj xyuas tsuas yog muab qhov pom, xim raws li qhia, uas yuav tsis raug xa mus rau cov neeg siv cov thev naus laus zis - xws li kev tshuaj ntsuam nyeem - lossis rau cov neeg siv tsis pom kev.
Xyuas kom meej tias muaj lwm qhov qhia txog lub xeev. Piv txwv li, koj tuaj yeem suav nrog cov lus qhia txog lub xeev hauv daim ntawv tswj cov <label>
ntawv nws tus kheej (raws li qhov xwm txheej hauv qhov piv txwv hauv qab no), suav nrog Glyphicon (nrog cov ntawv tsim nyog siv cov .sr-only
chav kawm - saib Glyphicon piv txwv ), lossis los ntawm kev muab ib qho ntxiv kev pab ntawv thaiv. Tshwj xeeb rau cov thev naus laus zis, kev tswj tsis tau daim ntawv tseem tuaj yeem raug muab rau tus aria-invalid="true"
cwj pwm.
Koj tseem tuaj yeem ntxiv cov tswv yim xaiv icons nrog qhov sib ntxiv ntawm .has-feedback
thiab lub cim zoo.
Cov lus teb cov lus pom tsuas yog ua haujlwm nrog cov ntawv nyeem <input class="form-control">
.
Kev tuav tuav ntawm cov lus tawm tswv yim yuav tsum muaj rau cov tswv yim yam tsis muaj daim ntawv lo thiab rau cov tswv yim pab pawg nrog ib qho ntxiv ntawm sab xis. Koj raug txhawb kom muab cov ntawv sau rau txhua qhov kev nkag mus rau qhov laj thawj nkag tau. Yog tias koj xav tiv thaiv cov ntawv los ntawm kev nthuav tawm, zais lawv nrog .sr-only
chav kawm. Yog tias koj yuav tsum ua yam tsis muaj daim ntawv lo, kho tus top
nqi ntawm lub tswv yim icon. Rau cov tswv yim pab pawg, kho tus right
nqi rau qhov tsim nyog pixel tus nqi nyob ntawm qhov dav ntawm koj qhov addon.
Txhawm rau kom ntseeg tau tias cov thev naus laus zis pabcuam - xws li kev tshuaj ntsuam nyeem ntawv - raug qhia lub ntsiab lus ntawm lub cim, cov ntawv zais ntxiv yuav tsum tau suav nrog hauv .sr-only
chav kawm thiab qhia meej nrog rau daim ntawv tswj nws cuam tshuam txog kev siv aria-describedby
. Xwb, xyuas kom meej tias lub ntsiab lus (piv txwv li, qhov tseeb tias muaj lus ceeb toom rau ib qho kev sau ntawv nkag teb) raug xa mus rau lwm daim ntawv, xws li hloov cov ntawv ntawm qhov tseeb <label>
cuam tshuam nrog daim ntawv tswj.
Txawm hais tias cov piv txwv hauv qab no twb tau hais txog qhov kev lees paub ntawm lawv cov ntawv tswj hwm hauv cov <label>
ntawv nyeem nws tus kheej, cov txheej txheem saum toj no (siv .sr-only
cov ntawv nyeem thiab aria-describedby
) tau suav nrog rau cov ntsiab lus piav qhia.
.sr-only
ntawv zaisYog tias koj siv cov .sr-only
chav kawm los nkaum daim ntawv tswj hwm <label>
(tsis yog siv lwm cov ntawv sau npe, xws li tus aria-label
cwj pwm), Bootstrap yuav hloov kho txoj haujlwm ntawm lub cim thaum nws tau ntxiv.
Teem qhov siab siv cov chav kawm xws li .input-lg
, thiab teeb tsa qhov dav siv kab ke kab ntawv zoo li .col-lg-*
.
Tsim daim ntawv siab dua los yog luv dua tswj uas phim cov pob loj.
Ceev cov ntawv loj thiab daim ntawv tswj tsis pub dhau .form-horizontal
los ntawm kev ntxiv .form-group-lg
lossis .form-group-sm
.
Qhwv cov khoom nkag rau hauv kab kab kab, lossis ib qho kev cai niam txiv, kom yooj yim tswj qhov dav xav tau.
Siv cov chav kawm khawm ntawm ib qho <a>
, <button>
, lossis <input>
cov khoom.
Thaum cov chav kawm khawm tuaj yeem siv rau <a>
thiab <button>
cov ntsiab lus, tsuas yog <button>
cov ntsiab lus tau txais kev txhawb nqa hauv peb cov khoom siv nav thiab navbar.
Yog tias cov <a>
ntsiab lus raug siv los ua cov nyees khawm - ua rau hauv nplooj ntawv ua haujlwm, es tsis yog mus rau lwm daim ntawv lossis ntu hauv nplooj ntawv tam sim no - lawv kuj yuav tsum tau muab qhov tsim nyog role="button"
.
Raws li qhov kev coj ua zoo tshaj plaws, peb pom zoo kom siv lub <button>
ntsiab lus thaum twg los tau los xyuas kom meej qhov sib piv ntawm qhov browser rendering.
Ntawm lwm yam, muaj kab laum hauv Firefox <30 uas tiv thaiv peb los ntawm kev teeb tsa cov nyees khawm line-height
ntawm <input>
-raws li, ua rau lawv tsis haum rau qhov siab ntawm lwm cov nyees khawm ntawm Firefox.
Siv ib qho ntawm cov chav kawm khawm muaj kom sai sai tsim ib lub pob styled.
Siv cov xim los ntxiv cov ntsiab lus rau lub pob tsuas yog muab qhov pom kev pom, uas yuav tsis raug xa mus rau cov neeg siv khoom siv thev naus laus zis - xws li cov ntawv nyeem. Xyuas kom meej tias cov ntaub ntawv qhia los ntawm cov xim yog pom tseeb los ntawm cov ntsiab lus nws tus kheej (cov ntawv pom ntawm lub pob), lossis suav nrog lwm txoj kev, xws li cov ntawv ntxiv zais nrog cov .sr-only
chav kawm.
Xav tau cov nyees khawm loj lossis me dua? Ntxiv .btn-lg
, .btn-sm
, lossis .btn-xs
rau qhov ntau thiab tsawg.
Tsim thaiv qib nyees khawm-cov uas nthuav dav dav ntawm niam txiv- los ntawm kev ntxiv .btn-block
.
Cov nyees khawm yuav tshwm sim (nrog rau tom qab tsaus nti, ciam teb tsaus nti, thiab teeb duab ntxoov ntxoo) thaum ua haujlwm. Rau <button>
cov ntsiab lus, qhov no yog ua los ntawm :active
. Rau <a>
cov ntsiab lus, nws tau ua tiav nrog .active
. Txawm li cas los xij, koj tuaj yeem siv .active
rau ntawm <button>
s (thiab suav nrog tus aria-pressed="true"
cwj pwm) yog tias koj xav tau rov ua dua lub xeev nquag ua haujlwm.
Tsis tas yuav ntxiv :active
raws li nws yog pseudo-chav kawm, tab sis yog tias koj xav tau yuam kom zoo li qub, mus tom ntej thiab ntxiv .active
.
Ntxiv cov .active
chav kawm rau <a>
cov nyees khawm.
Ua cov nyees khawm zoo li unclickable los ntawm fading lawv rov qab nrog opacity
.
Ntxiv tus disabled
cwj pwm rau <button>
cov nyees khawm.
Yog tias koj ntxiv tus disabled
cwj pwm rau ib qho <button>
, Internet Explorer 9 thiab hauv qab no yuav ua cov ntawv grey nrog cov ntawv tsis zoo-duab ntxoov ntxoo uas peb kho tsis tau.
Ntxiv cov .disabled
chav kawm rau <a>
cov nyees khawm.
Peb siv .disabled
raws li chav kawm siv hluav taws xob ntawm no, zoo ib yam li cov .active
chav kawm sib xws, yog li tsis tas yuav tsum tau ua ntej.
Cov chav kawm no siv pointer-events: none
los sim lov tes taw kev ua haujlwm txuas ntawm <a>
s, tab sis cov cuab yeej CSS tseem tsis tau ua qauv thiab tsis tau txais kev txhawb siab hauv Opera 18 thiab hauv qab no, lossis hauv Internet Explorer 11. Tsis tas li ntawd, txawm nyob hauv browsers uas txhawb nqa pointer-events: none
, keyboard. navigation tseem tsis cuam tshuam, txhais tau hais tias cov neeg siv cov keyboard pom thiab cov neeg siv cov cuab yeej pabcuam tseem tuaj yeem qhib cov kev txuas no. Yog li kom muaj kev nyab xeeb, siv kev cai JavaScript los lov tes taw cov kev sib txuas.
Cov duab hauv Bootstrap 3 tuaj yeem ua tau raws li tus phooj ywg ntawm qhov sib ntxiv ntawm .img-responsive
chav kawm. Qhov no siv max-width: 100%;
, height: auto;
thiab display: block;
rau cov duab kom nws scales nicely rau niam txiv lub caij.
Txhawm rau nruab nrab cov duab uas siv cov .img-responsive
chav kawm, siv .center-block
tsis yog .text-center
. Saib cov chav kawm pab kom paub meej ntxiv txog .center-block
kev siv.
Hauv Internet Explorer 8-10, SVG cov duab nrog .img-responsive
qhov loj me me. Txhawm rau kho qhov no, ntxiv width: 100% \9;
qhov tsim nyog. Bootstrap tsis siv qhov no cia li ua rau muaj teeb meem rau lwm hom duab.
Ntxiv cov chav kawm rau ib <img>
lub caij kom yooj yim style dluab nyob rau hauv txhua qhov project.
Nco ntsoov tias Internet Explorer 8 tsis muaj kev txhawb nqa rau cov ces kaum sib npaug.
Qhia lub ntsiab lus los ntawm cov xim nrog ib txhais tes ntawm cov chav kawm siv hluav taws xob. Cov no kuj tseem siv tau rau cov kev sib txuas thiab yuav tsaus ntuj rau ntawm hover ib yam li peb cov qauv txuas txuas.
Fusce dapibus, tellus ac cursus commodo, tortor mauris nibh.
Nullam id dolor id nibh ultricies vehicula ut id elit.
Duis mollis, tsis yog commodo luctus, nisi erat porttitor ligula.
Maecenas sed diam eget risus varius blandit zaum amet tsis magna.
Etiam porta sem malesuada magna mollis euismod.
Donec ullamcorper nulla non metus auctor fringilla.
Qee zaum cov chav kawm tseem ceeb tsis tuaj yeem siv vim qhov tshwj xeeb ntawm lwm tus neeg xaiv. Feem ntau, ib qho kev ua haujlwm txaus yog los qhwv koj cov ntawv hauv ib chav <span>
nrog chav kawm.
Siv cov xim los ntxiv cov ntsiab lus tsuas yog muab qhov pom kev pom, uas yuav tsis raug xa mus rau cov neeg siv cov thev naus laus zis pab - xws li cov ntawv nyeem. Xyuas kom meej tias cov ntaub ntawv qhia los ntawm cov xim yog pom tseeb los ntawm cov ntsiab lus nws tus kheej (cov ntsiab lus xim tsuas yog siv los txhawb lub ntsiab lus uas twb muaj nyob rau hauv cov ntawv nyeem / cim), lossis suav nrog lwm txoj kev, xws li cov ntawv ntxiv zais nrog cov .sr-only
chav kawm . .
Zoo ib yam li cov chav kawm ntawv xim xim, yooj yim teeb lub keeb kwm yav dhau ntawm ib lub caij rau txhua chav kawm ntawv. Anchor Cheebtsam yuav tsaus rau hover, ib yam li cov ntawv nyeem.
Nullam id dolor id nibh ultricies vehicula ut id elit.
Duis mollis, tsis yog commodo luctus, nisi erat porttitor ligula.
Maecenas sed diam eget risus varius blandit zaum amet tsis magna.
Etiam porta sem malesuada magna mollis euismod.
Donec ullamcorper nulla non metus auctor fringilla.
Qee zaum cov chav kawm keeb kwm yav dhau los tsis tuaj yeem siv vim qhov tshwj xeeb ntawm lwm tus neeg xaiv. Qee zaum, kev ua haujlwm txaus yog los qhwv koj lub ntsiab lus hauv ib chav <div>
nrog chav kawm.
Raws li nrog cov xim contextual , xyuas kom meej tias txhua lub ntsiab lus uas tau hais los ntawm cov xim kuj tau nthuav tawm hauv ib hom ntawv uas tsis yog kev nthuav qhia.
Siv lub cim ze ze rau kev tso tawm cov ntsiab lus xws li modals thiab ceeb toom.
Siv carts los qhia txog kev ua haujlwm poob qis thiab kev taw qhia. Nco ntsoov tias lub neej ntawd caret yuav thim rov qab rau hauv dropup menus .
Float ib lub caij mus rau sab laug lossis sab xis nrog chav kawm. !important
suav nrog kom tsis txhob muaj teeb meem tshwj xeeb. Cov chav kawm kuj tseem siv tau ua cov mixins.
Teem lub ntsiab rau display: block
thiab nruab nrab ntawm margin
. Muaj raws li kev sib xyaw thiab chav kawm.
Yooj yim tshem float
s los ntawm kev ntxiv .clearfix
rau cov niam txiv keeb . Siv micro clearfix li nrov los ntawm Nicolas Gallagher. Kuj tseem siv tau los ua ib qho mixin.
quab yuam kom pom lossis zais ( nrog rau cov neeg nyeem ntawv ) nrog rau kev siv .show
thiab .hidden
cov chav kawm. Cov chav kawm no siv !important
kom tsis txhob muaj kev tsis sib haum xeeb tshwj xeeb, ib yam li qhov nrawm nrawm . Lawv tsuas yog muaj rau thaiv qib toggling. Lawv tuaj yeem siv los ua cov mixins.
.hide
muaj, tab sis nws tsis tas yuav cuam tshuam rau cov neeg nyeem ntawv tshuaj ntsuam thiab yog deprecated li ntawm v3.0.1. Siv .hidden
lossis .sr-only
hloov.
Tsis tas li ntawd, .invisible
tuaj yeem siv los hloov pauv tsuas yog qhov pom ntawm lub ntsiab lus, lub ntsiab lus nws display
tsis hloov kho thiab lub ntsiab tseem tuaj yeem cuam tshuam rau qhov ntws ntawm cov ntaub ntawv.
Nkaum ib lub ntsiab lus rau txhua yam khoom siv tshwj tsis yog cov ntawv nyeem nrog .sr-only
. Ua ke .sr-only
nrog .sr-only-focusable
los qhia lub caij dua thaum nws tau tsom (xws li los ntawm tus neeg siv keyboard nkaus xwb). Yuav tsum tau ua raws li kev coj ua zoo tshaj plaws . Kuj tseem siv tau ua cov mixins.
Siv cov .text-hide
chav kawm lossis mixin los pab hloov lub ntsiab lus cov ntsiab lus nrog cov duab tom qab.
Txhawm rau txhim kho lub xov tooj sai dua, siv cov chav kawm siv hluav taws xob no los qhia thiab zais cov ntsiab lus los ntawm cov khoom siv los ntawm kev nug xov xwm. Kuj tseem muaj cov chav kawm siv hluav taws xob rau toggling cov ntsiab lus thaum luam tawm.
Sim siv cov no nyob rau hauv ib qho txwv thiab tsis txhob tsim cov versions sib txawv ntawm tib lub xaib. Hloov chaw, siv lawv los ntxiv rau txhua lub cuab yeej kev nthuav qhia.
Siv ib qho los yog sib xyaw ua ke ntawm cov chav kawm muaj rau toggling cov ntsiab lus hla cov chaw saib xyuas qhov chaw.
Cov khoom siv me me ntxivXov tooj (<768px) | Cov khoom siv me meCov ntsiav tshuaj (≥768px) | Cov khoom siv nruab nrabDesktops (≥992px) | Cov khoom siv lojDesktops (≥1200px) | |
---|---|---|---|---|
.visible-xs-* |
Pom tau | zais | zais | zais |
.visible-sm-* |
zais | Pom tau | zais | zais |
.visible-md-* |
zais | zais | Pom tau | zais |
.visible-lg-* |
zais | zais | zais | Pom tau |
.hidden-xs |
zais | Pom tau | Pom tau | Pom tau |
.hidden-sm |
Pom tau | zais | Pom tau | Pom tau |
.hidden-md |
Pom tau | Pom tau | zais | Pom tau |
.hidden-lg |
Pom tau | Pom tau | Pom tau | zais |
Raws li ntawm v3.2.0, cov .visible-*-*
chav kawm rau txhua qhov kev tawg tuaj nyob hauv peb qhov kev hloov pauv, ib qho rau txhua tus nqi ntawm CSS display
tau teev tseg hauv qab no.
Pab pawg ntawm cov chav kawm | CSSdisplay |
---|---|
.visible-*-block |
display: block; |
.visible-*-inline |
display: inline; |
.visible-*-inline-block |
display: inline-block; |
Yog li, xs
piv txwv li, rau cov ntxaij vab tshaus me me, cov .visible-*-*
chav kawm muaj xws li: .visible-xs-block
, .visible-xs-inline
, thiab .visible-xs-inline-block
.
Cov chav kawm .visible-xs
, .visible-sm
, .visible-md
, thiab .visible-lg
tseem muaj nyob, tab sis yog deprecated raws li v3.2.0 . Lawv yog kwv yees li sib npaug rau .visible-*-block
, tshwj tsis yog muaj cov xwm txheej tshwj xeeb ntxiv rau toggling <table>
- ntsig txog cov ntsiab lus.
Zoo ib yam li cov chav kawm teb, siv cov no rau toggling cov ntsiab lus rau luam tawm.
Cov chav kawm | Browser | Luam tawm |
---|---|---|
.visible-print-block .visible-print-inline .visible-print-inline-block |
zais | Pom tau |
.hidden-print |
Pom tau | zais |
Cov chav kawm .visible-print
kuj muaj tab sis yog deprecated raws li v3.2.0. Nws yog kwv yees li sib npaug rau .visible-print-block
, tshwj tsis yog muaj cov xwm txheej tshwj xeeb ntxiv rau <table>
cov ntsiab lus ntsig txog.
Hloov kho koj tus browser lossis thauj khoom ntawm cov khoom siv sib txawv los ntsuas cov chav kawm siv hluav taws xob.
Green checkmarks qhia tias lub caij pom hauv koj qhov chaw saib tam sim no.
Ntawm no, ntsuab checkmarks kuj qhia tias lub caij yog muab zais rau hauv koj qhov chaw saib tam sim no.
Bootstrap's CSS yog tsim los ntawm Less, preprocessor nrog kev ua haujlwm ntxiv xws li kev sib txawv, mixins, thiab ua haujlwm rau kev sau CSS. Cov uas tab tom nrhiav siv cov ntaub ntawv tsawg dua es tsis txhob ntawm peb cov ntaub ntawv CSS tau muab tso ua ke tuaj yeem siv ntau qhov sib txawv thiab cov khoom sib xyaw uas peb siv thoob plaws hauv lub moj khaum.
Grid variables thiab mixins yog them nyob rau hauv tshooj Grid system .
Bootstrap tuaj yeem siv tsawg kawg yog ob txoj hauv kev: nrog CSS suav nrog lossis nrog cov ntaub ntawv tsawg dua. Txhawm rau sau cov ntaub ntawv tsawg dua, sab laj rau ntu Pib pib yuav ua li cas teeb tsa koj qhov chaw tsim kho kom khiav cov lus txib tsim nyog.
Cov cuab yeej muab tso ua ke thib peb tuaj yeem ua haujlwm nrog Bootstrap, tab sis lawv tsis tau txais kev txhawb nqa los ntawm peb pab pawg tseem ceeb.
Cov kev sib txawv yog siv thoob plaws hauv qhov project tag nrho raws li ib txoj hauv kev hauv nruab nrab thiab sib faib cov txiaj ntsig uas siv ntau yam xws li xim, qhov sib txawv, lossis cov font stacks. Txhawm rau ua kom tiav, thov mus saib Customizer .
Yooj yim siv ob lub tswv yim xim: greyscale thiab semantic. Greyscale xim muab kev nkag tau sai rau cov xim dub feem ntau siv thaum lub sij hawm semantic suav nrog ntau yam xim muab rau cov ntsiab lus tseem ceeb.
Siv ib qho ntawm cov xim hloov pauv raws li lawv yog lossis rov muab lawv rau ntau qhov sib txawv rau koj qhov project.
Ib txhais tes ntawm kev hloov pauv sai sai rau kev hloov kho cov ntsiab lus tseem ceeb ntawm koj lub xaib lub cev pob txha.
Yooj yim style koj cov kev sib txuas nrog cov xim zoo nrog tib tus nqi.
Nco ntsoov tias qhov kev @link-hover-color
siv ib qho kev ua haujlwm, lwm lub cuab yeej txaus los ntawm Less, kom automagically tsim cov xim hover txoj cai. Koj tuaj yeem siv darken
, lighten
, saturate
, thiab desaturate
.
Yooj yim teeb tsa koj hom ntawv, ntawv loj, ua, thiab ntau ntxiv nrog ob peb qhov hloov pauv sai. Bootstrap ua rau siv cov no thiab muab cov ntawv sau yooj yim sib xyaw.
Ob qhov hloov pauv ceev rau customizing qhov chaw thiab filename ntawm koj lub cim.
Cov Cheebtsam thoob plaws hauv Bootstrap ua rau siv qee qhov kev hloov pauv tsis zoo rau kev teeb tsa cov txiaj ntsig zoo. Ntawm no yog cov feem ntau siv.
Cov neeg muag khoom mixins yog cov mixins los pab txhawb ntau lub browsers los ntawm kev suav nrog txhua tus neeg muag khoom npe ua ntej hauv koj li CSS.
Pib dua koj cov khoom 'lub thawv qauv nrog ib qho mixin. Rau cov ntsiab lus, saib cov kab lus no pab tau los ntawm Mozilla .
Cov mixin yog deprecated li ntawm v3.2.0, nrog rau kev taw qhia ntawm Autoprefixer. Txhawm rau khaws rov qab-kev sib raug zoo, Bootstrap yuav txuas ntxiv siv cov mixin sab hauv kom txog thaum Bootstrap v4.
Niaj hnub no tag nrho cov niaj hnub browsers txhawb cov khoom tsis yog ua ntej border-radius
. Xws li, tsis muaj kev .border-radius()
sib xyaw, tab sis Bootstrap suav nrog shortcuts kom nrawm nrawm ob lub ces kaum ntawm ib sab ntawm ib qho khoom.
Yog tias koj lub hom phiaj cov neeg tuaj saib yog siv qhov tseeb thiab zoo tshaj plaws browsers thiab cov khoom siv, nco ntsoov tsuas yog siv cov box-shadow
cuab yeej ntawm nws tus kheej. Yog tias koj xav tau kev txhawb nqa rau cov laus hauv Android (pre-v4) thiab iOS pab kiag li lawm (pre-iOS 5), siv cov khoom siv tsis txaus los khaws cov -webkit
lus ua ntej.
Lub mixin yog deprecated li ntawm v3.1.0, txij li thaum Bootstrap tsis officially txhawb lub outdated platforms uas tsis txhawb tus qauv khoom. Txhawm rau khaws rov qab-kev sib raug zoo, Bootstrap yuav txuas ntxiv siv cov mixin sab hauv kom txog thaum Bootstrap v4.
Nco ntsoov siv rgba()
cov xim hauv koj lub thawv duab ntxoov ntxoo kom lawv sib xyaw ua ke zoo li ua tau nrog keeb kwm yav dhau.
Ntau mixins rau yooj. Teem tag nrho cov ntaub ntawv hloov pauv nrog ib qho, lossis qhia qhov ncua sij hawm thiab ncua sij hawm raws li xav tau.
Cov mixins yog deprecated li ntawm v3.2.0, nrog rau kev taw qhia ntawm Autoprefixer. Txhawm rau khaws rov qab-kev sib raug zoo, Bootstrap yuav txuas ntxiv siv cov mixins sab hauv kom txog thaum Bootstrap v4.
Tig, ntsuas, txhais (tsav), lossis skew ib yam khoom.
Cov mixins yog deprecated li ntawm v3.2.0, nrog rau kev taw qhia ntawm Autoprefixer. Txhawm rau khaws rov qab-kev sib raug zoo, Bootstrap yuav txuas ntxiv siv cov mixins sab hauv kom txog thaum Bootstrap v4.
Ib qho mixin rau kev siv tag nrho ntawm CSS3 cov cuab yeej animation hauv ib qho kev tshaj tawm thiab lwm cov mixins rau cov khoom ntiag tug.
Cov mixins yog deprecated li ntawm v3.2.0, nrog rau kev taw qhia ntawm Autoprefixer. Txhawm rau khaws rov qab-kev sib raug zoo, Bootstrap yuav txuas ntxiv siv cov mixins sab hauv kom txog thaum Bootstrap v4.
Teem lub opacity rau tag nrho cov browsers thiab muab ib tug filter
poob rau IE8.
Muab cov ntsiab lus rau daim ntawv tswj hauv txhua qhov chaw.
Tsim cov kab ntawm CSS hauv ib lub caij.
Yooj yim tig ob xim rau hauv ib qho gradient tom qab. Tau txais kev tshaj lij thiab teeb tsa kev taw qhia, siv peb xim, lossis siv qhov radial gradient. Nrog ib tug mixin koj tau txais tag nrho cov prefixed syntaxes koj yuav xav tau.
Koj tuaj yeem hais qhia lub kaum sab xis ntawm tus qauv ob-xim, linear gradient:
Yog hais tias koj xav tau ib tug barber-stripe style gradient, uas yog ib qho yooj yim, ib yam nkaus thiab. Tsuas yog qhia ib qho xim xwb thiab peb mam li overlay ib kab dawb translucent.
Nce lub ante thiab siv peb xim xwb. Teem thawj xim, xim thib ob, xim xim xim thib ob (ib feem pua tus nqi zoo li 25%), thiab xim thib peb nrog cov mixins:
Tau taub hau! Yog tias koj puas xav tau tshem tawm qhov gradient, nco ntsoov tshem tawm ib qho IE tshwj xeeb uas filter
koj tau ntxiv. Koj tuaj yeem ua qhov ntawd los ntawm kev siv cov .reset-filter()
mixin ib sab background-image: none;
.
Utility mixins yog cov mixins uas sib txuas lwm yam tsis cuam tshuam nrog CSS cov khoom kom ua tiav lub hom phiaj tshwj xeeb lossis ua haujlwm.
Tsis nco qab ntxiv class="clearfix"
rau txhua lub ntsiab lus thiab hloov cov .clearfix()
mixin qhov tsim nyog. Siv micro clearfix los ntawm Nicolas Gallagher .
Ceev nrooj nruab ib qho hauv nws niam nws txiv. Yuav tsum tau width
los yog max-width
yuav tsum tau teem.
Qhia qhov ntev ntawm ib yam khoom yooj yim dua.
Yooj yim configure cov kev xaiv resize rau tej textarea, los yog lwm yam khoom. Defaults rau ib txwm browser tus cwj pwm ( both
).
Yooj yim txiav cov ntawv nrog ib qho ellipsis nrog ib qho mixin. Yuav tsum muaj lub hauv paus los block
yog inline-block
qib.
Qhia ob txoj hauv kev duab thiab @ 1x duab qhov ntev, thiab Bootstrap yuav muab cov lus nug @2x. Yog tias koj muaj ntau cov duab los ua haujlwm, xav txog kev sau koj cov duab retina CSS manually hauv ib qho lus nug xov xwm.
Thaum Bootstrap yog tsim los ntawm Tsawg, nws kuj muaj qhov chaw nres nkoj Sass . Peb tuav nws hauv ib qho chaw khaws cia GitHub cais thiab tuav cov kev hloov tshiab nrog tsab ntawv hloov dua siab tshiab.
Txij li thaum qhov chaw nres nkoj Sass muaj ib qho repo cais thiab ua hauj lwm rau cov neeg tuaj saib sib txawv me ntsis, cov ntsiab lus ntawm qhov project txawv heev los ntawm lub ntsiab Bootstrap project. Qhov no ua kom qhov chaw nres nkoj Sass yog sib xws nrog ntau Sass-based systems li sai tau.
Txoj kev | Kev piav qhia |
---|---|
lib/ |
Ruby lub pov haum code (Sass configuration, Rails thiab Compass integrations) |
tasks/ |
Hloov cov ntawv sau (tig qis qis rau Sass) |
test/ |
Kev ntsuam xyuas muab tso ua ke |
templates/ |
Compass pob manifest |
vendor/assets/ |
Sass, JavaScript, thiab font files |
Rakefile |
Cov haujlwm sab hauv, xws li rake thiab hloov pauv |
Mus ntsib Sass chaw nres nkoj GitHub chaw cia khoom kom pom cov ntaub ntawv no ua haujlwm.
Yog xav paub ntxiv txog yuav ua li cas rau nruab thiab siv Bootstrap rau Sass, sab laj GitHub repository readme . Nws yog qhov tseeb tshaj plaws thiab suav nrog cov ntaub ntawv siv nrog Rails, Compass, thiab cov haujlwm Sass txheem.