Bikɔs ɔf di bɔku bɔku yus fɔ <table>ɛlimɛnt dɛn akɔdin to tɔd-pati widget dɛn lɛk kalenda ɛn de pik, Bootstrap in tebul dɛn na opt-in . Ad di bays klas .tableto ɛni wan <table>, dɔn ɛkstɛnd wit wi opshɔnal modifya klas dɛn ɔ kɔstɔm stayl dɛn. Ɔl di tebul stayl dɛn nɔ de inhɛrit insay Bootstrap, we min se ɛni tebul we dɛn dɔn nɛst kin stayl indipɛndɛnt frɔm di mama ɔ papa.
Yuz di mɔs besik tebul mak, na ya aw .table-based tebul dɛn de luk na Bootstrap.
# Di wan dɛn we de
Fɔs
Las
Sɔlv
1. Di wan dɛn we de
Mak
Ɔto bin de
@mdo na @mdo
2. Di wan dɛn we de
Jekɔb
Tɔntɔn
@bɔmp
3. Di wan dɛn we de
Larry di Bɔd
@twita na di twitter
<tableclass="table"><thead><tr><thscope="col">#</th><thscope="col">First</th><thscope="col">Last</th><thscope="col">Handle</th></tr></thead><tbody><tr><thscope="row">1</th><td>Mark</td><td>Otto</td><td>@mdo</td></tr><tr><thscope="row">2</th><td>Jacob</td><td>Thornton</td><td>@fat</td></tr><tr><thscope="row">3</th><tdcolspan="2">Larry the Bird</td><td>@twitter</td></tr></tbody></table>
Di difrɛn difrɛn tin dɛn we dɛn kin yuz
Yuz kɔntɛkstual klas fɔ kala tebul, tebul rɔw ɔ wan wan sɛl dɛn.
Klas
Di edlayn
Di edlayn
Balans
Sɛl
Sɛl
Fɔs
Sɛl
Sɛl
Sɛkɔndari
Sɛl
Sɛl
Go bifo
Sɛl
Sɛl
Denja
Sɛl
Sɛl
Wɔnin
Sɛl
Sɛl
Info
Sɛl
Sɛl
Layt
Sɛl
Sɛl
Dak
Sɛl
Sɛl
<!-- On tables --><tableclass="table-primary">...</table><tableclass="table-secondary">...</table><tableclass="table-success">...</table><tableclass="table-danger">...</table><tableclass="table-warning">...</table><tableclass="table-info">...</table><tableclass="table-light">...</table><tableclass="table-dark">...</table><!-- On rows --><trclass="table-primary">...</tr><trclass="table-secondary">...</tr><trclass="table-success">...</tr><trclass="table-danger">...</tr><trclass="table-warning">...</tr><trclass="table-info">...</tr><trclass="table-light">...</tr><trclass="table-dark">...</tr><!-- On cells (`td` or `th`) --><tr><tdclass="table-primary">...</td><tdclass="table-secondary">...</td><tdclass="table-success">...</td><tdclass="table-danger">...</td><tdclass="table-warning">...</td><tdclass="table-info">...</td><tdclass="table-light">...</td><tdclass="table-dark">...</td></tr>
Fɔ gi minin to ɛtɛknɔlɔji dɛn we de ɛp
Yuz kala fɔ ad minin de jɔs gi wan vijual indikashɔn, we dɛn nɔ go gi to di wan dɛn we de yuz ɛtɛknɔlɔji dɛn we de ɛp – lɛk skrin rida dɛn. Mek shɔ se di infɔmeshɔn we dɛn sho wit di kɔlɔ de sho klia wan frɔm di tin we de insay insɛf (ɛgz. di tɛks we yu de si), ɔ dɛn put am insay ɔda we dɛn, lɛk ɔda tɛks we dɛn ayd wit di .visually-hiddenklas.
Tebul dɛn we gɛt aksɛn
Row dɛn we gɛt strɛp
Yuz .table-stripedfɔ ad zibra-strip to ɛni tebul row insay di <tbody>.
# Di wan dɛn we de
Fɔs
Las
Sɔlv
1. Di wan dɛn we de
Mak
Ɔto bin de
@mdo na @mdo
2. Di wan dɛn we de
Jekɔb
Tɔntɔn
@bɔmp
3. Di wan dɛn we de
Larry di Bɔd
@twita na di twitter
<tableclass="table table-striped">
...
</table>
Dɛn kin ad dɛn klas ya bak to di wan dɛn we de na di tebul:
Wi kin bigin bay we wi de sɛt di bakgrɔn fɔ wan tebul sɛl wit di --bs-table-bgkɔstɔm prɔpati. Ɔl di tebul vayriɔnt dɛn dɔn sɛt da kɔstɔm prɔpati de fɔ kala di tebul sɛl dɛn. Dis we ya, wi nɔ de gɛt prɔblɛm if dɛn yuz sɛmi-transparent kɔlɔ dɛn as tebul bakgrɔn.
Dɔn wi ad wan insɛt bɔks shado na di tebul sɛl dɛn wit box-shadow: inset 0 0 0 9999px var(--bs-table-accent-bg);to layt ɔp ɛni spɛsifikɛd background-color. Bikɔs wi de yuz big big spred ɛn nɔ blɔk, di kɔlɔ go bi wanwɔd. Sins --bs-table-accent-bgna unset bay difɔlt, wi nɔ gɛt difɔlt bɔks shado.
We dɛn ad ɛni wan pan dɛn .table-striped, .table-hoverɔ .table-activeklas dɛn, dɛn --bs-table-accent-bgkin sɛt di wan to wan sɛmitransparent kɔlɔ fɔ mek di bakgrɔn gɛt kɔlɔ.
Fɔ ɛni tebul we difrɛn, wi kin mek wan --bs-table-accent-bgkɔlɔ we gɛt di kɔntrast we pas ɔl dipen pan da kɔlɔ de. Fɔ ɛgzampul, di aksɛn kɔlɔ fɔ .table-primaryde dak we .table-darki gɛt layt aksɛn kɔlɔ.
Dɛn kin mek tɛks ɛn bɔda kɔlɔ dɛn di sem we, ɛn dɛn kin gɛt dɛn kɔlɔ dɛn bay difɔlt.
Tebul sεl dεm fכ <thead>de כltεm vεtikal alaynεd to di bכtכm. Tebul sɛl dɛn in <tbody>inhɛrit dɛn alaynɛshɔn frɔm <table>ɛn dɛn alaynɛd to di di tɔp bay difɔlt. Yuz di vertikal alaynɛshɔn klas dɛn fɔ ri-alayn usay nid de.
Di edlayn 1
Di edlayn 2
Di edlayn 3
Di edlayn 4
Dis sɛl de gɛt vertical-align: middle;frɔm di tebul
Dis sɛl de gɛt vertical-align: middle;frɔm di tebul
Dis sɛl de gɛt vertical-align: middle;frɔm di tebul
Dis ya na sɔm pleshɔlda tɛks, we dɛn bin want fɔ tek bɔku vertikal spɛs, fɔ sho aw di vertikal alaynɛshɔn de wok na di sɛl dɛn we de bifo.
Dis sɛl de inhɛrit vertical-align: bottom;frɔm di tebul rɔw
Dis sɛl de inhɛrit vertical-align: bottom;frɔm di tebul rɔw
Dis sɛl de inhɛrit vertical-align: bottom;frɔm di tebul rɔw
Dis ya na sɔm pleshɔlda tɛks, we dɛn bin want fɔ tek bɔku vertikal spɛs, fɔ sho aw di vertikal alaynɛshɔn de wok na di sɛl dɛn we de bifo.
Dis sɛl de gɛt vertical-align: middle;frɔm di tebul
Dis sɛl de gɛt vertical-align: middle;frɔm di tebul
Dis sɛl de alaynɛd to di ɔp pat.
Dis ya na sɔm pleshɔlda tɛks, we dɛn bin want fɔ tek bɔku vertikal spɛs, fɔ sho aw di vertikal alaynɛshɔn de wok na di sɛl dɛn we de bifo.
<divclass="table-responsive"><tableclass="table align-middle"><thead><tr>
...
</tr></thead><tbody><tr>
...
</tr><trclass="align-bottom">
...
</tr><tr><td>...</td><td>...</td><tdclass="align-top">This cell is aligned to the top.</td><td>...</td></tr></tbody></table></div>
Fɔ mek dɛn nɛst
Bɔda stayl dɛn, aktif stayl dɛn, ɛn tebul difrɛn dɛn nɔ de inhɛrit frɔm tebul dɛn we dɛn dɔn nest.
Fɔ mek ɛni stayl nɔ lik to tebul dɛn we dɛn dɔn nest, wi de yuz di pikin kɔmbayntɔ ( >) sɛlɛktɔ na wi CSS. Sins wi nid fɔ target ɔl di tds ɛn ths dɛn na di thead, tbody, ɛn tfoot, wi sɛlɛktɔ go luk fayn fayn wan if i nɔ de. As a so, wi yuz di rather odd lukin .table > :not(caption) > * > *selekta fɔ target ɔl di tds ɛn ths dɛn na di .table, bɔt nɔ pan ɛni pɔtɛnɛshɛl nest tebul dɛn.
Notis se if yu ad <tr>s as dairekt pikin dɛn fɔ wan tebul, dɛn wan <tr>dɛn de go rap insay a <tbody>bay difɔlt, so dat go mek wi sɛlɛktɔ dɛn wok lɛk aw dɛn bin want fɔ du am.
Anatomi fɔ di bɔdi
Tebul ed
Semweso lɛk tebul ɛn dak tebul, yuz di modifya klas dɛn .table-lightɔ .table-darkfɔ mek <thead>s tan lɛk layt ɔ dak grey.
A <caption>de wok lɛk ed fɔ tebul. I de ɛp pipul dɛn we gɛt skrin rida fɔ fɛn tebul ɛn ɔndastand wetin i de tɔk bɔt ɛn disayd if dɛn want fɔ rid am.
Lista fɔ di wan dɛn we de yuz am
# Di wan dɛn we de
Fɔs
Las
Sɔlv
1. Di wan dɛn we de
Mak
Ɔto bin de
@mdo na @mdo
2. Di wan dɛn we de
Jekɔb
Tɔntɔn
@bɔmp
3. Di wan dɛn we de
Larry di Bɔd
@twita na di twitter
<tableclass="table table-sm"><caption>List of users</caption><thead>
...
</thead><tbody>
...
</tbody></table>
Yu kin put di <caption>bak ɔp di tebul wit .caption-top.
Lista fɔ di wan dɛn we de yuz am
# Di wan dɛn we de
Fɔs
Las
Sɔlv
1. Di wan dɛn we de
Mak
Ɔto bin de
@mdo na @mdo
2. Di wan dɛn we de
Jekɔb
Tɔntɔn
@bɔmp
3. Di wan dɛn we de
Lari bin de tɔk
di Bɔd
@twita na di twitter
<tableclass="table caption-top"><caption>List of users</caption><thead><tr><thscope="col">#</th><thscope="col">First</th><thscope="col">Last</th><thscope="col">Handle</th></tr></thead><tbody><tr><thscope="row">1</th><td>Mark</td><td>Otto</td><td>@mdo</td></tr><tr><thscope="row">2</th><td>Jacob</td><td>Thornton</td><td>@fat</td></tr><tr><thscope="row">3</th><td>Larry</td><td>the Bird</td><td>@twitter</td></tr></tbody></table>
Tebul dɛn we de ansa
Tebul dɛn we de ansa kin mek dɛn ebul fɔ skrol tebul dɛn ɔrizɔntal wan wit izi wan. Mek ɛni tebul we de ansa akɔdin to ɔl di viupɔt dɛn bay we yu rap wan .tablewit .table-responsive. Ɔ, pik wan maksimal brekpoint wit we yu go gɛt tebul we de ansa to bay we yu yuz .table-responsive{-sm|-md|-lg|-xl|-xxl}.
Vɛtikal klipin/trɔnkɛshɔn
Tebul dɛn we de ansa kin yuz overflow-y: hidden, we kin klip ɛnitin we de insay di tebul we de dɔŋ ɔ ɔp. Na mɔtalman, dis kin klip ɔf drɔpdɔwn mɛnyu dɛn ɛn ɔda tɔd-pati widget dɛn.
Ɔltɛm we de ansa
Akɔs ɛvri brekpoint, yuz .table-responsivefɔ ɔrizɔntal skrol tebul dɛn.
Yuz .table-responsive{-sm|-md|-lg|-xl|-xxl}as nid de fɔ mek tebul dɛn we de ansa te to wan patikyula brekpoint. Frɔm da brek-point de ɛn ɔp, di tebul go biev nɔmal wan ɛn i nɔ go skrol ɔrizɔntal wan.
Dɛn tebul dɛn ya kin tan lɛk se dɛn dɔn brok te dɛn stayl dɛn we de ansa aplay na sɔm patikyula viupɔt wit dɛn.