Iwe ati awọn apẹẹrẹ fun ijade-iṣafihan awọn tabili (fifun lilo lilo wọn ni awọn afikun JavaScript) pẹlu Bootstrap.
Awọn apẹẹrẹ
Nitori lilo awọn tabili ni ibigbogbo kọja awọn ẹrọ ailorukọ ẹnikẹta bi awọn kalẹnda ati awọn oluyan ọjọ, a ti ṣe apẹrẹ awọn tabili wa lati wọle . Kan ṣafikun kilasi ipilẹ .tablesi eyikeyi <table>, lẹhinna fa pẹlu awọn aṣa aṣa tabi awọn kilasi iyipada ti o wa pẹlu ọpọlọpọ.
Lilo isamisi tabili ipilẹ julọ, eyi ni bii awọn .tabletabili orisun ṣe wo ni Bootstrap. Gbogbo awọn aza tabili ni a jogun ni Bootstrap 4 , afipamo pe awọn tabili itẹ-ẹiyẹ eyikeyi yoo jẹ aṣa ni ọna kanna bi obi.
Fi kun .table-borderedfun awọn aala lori gbogbo awọn ẹgbẹ ti tabili ati awọn sẹẹli.
#
Akoko
Ikẹhin
Mu
1
Samisi
Otto
@mdo
2
Jakobu
Thornton
@sanra
3
Larry Eye
@twitter
<tableclass="table table-bordered"><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>
#
Akoko
Ikẹhin
Mu
1
Samisi
Otto
@mdo
2
Jakobu
Thornton
@sanra
3
Larry Eye
@twitter
<tableclass="table table-bordered table-dark"><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>
Aala tabili
Fi kun .table-borderlessfun tabili laisi awọn aala.
#
Akoko
Ikẹhin
Mu
1
Samisi
Otto
@mdo
2
Jakobu
Thornton
@sanra
3
Larry Eye
@twitter
<tableclass="table table-borderless"><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>
.table-borderlesstun le ṣee lo lori dudu tabili.
#
Akoko
Ikẹhin
Mu
1
Samisi
Otto
@mdo
2
Jakobu
Thornton
@sanra
3
Larry Eye
@twitter
<tableclass="table table-borderless table-dark"><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>
Hoverable awọn ori ila
Fikun -un .table-hoverlati mu ipo fifin ṣiṣẹ lori awọn ori ila tabili laarin faili kan <tbody>.
#
Akoko
Ikẹhin
Mu
1
Samisi
Otto
@mdo
2
Jakobu
Thornton
@sanra
3
Larry Eye
@twitter
<tableclass="table table-hover"><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>
#
Akoko
Ikẹhin
Mu
1
Samisi
Otto
@mdo
2
Jakobu
Thornton
@sanra
3
Larry Eye
@twitter
<tableclass="table table-hover table-dark"><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>
Kekere tabili
Fikun -un .table-smlati ṣe awọn tabili ni iwapọ diẹ sii nipa gige fifẹ sẹẹli ni idaji.
#
Akoko
Ikẹhin
Mu
1
Samisi
Otto
@mdo
2
Jakobu
Thornton
@sanra
3
Larry Eye
@twitter
<tableclass="table table-sm"><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>
#
Akoko
Ikẹhin
Mu
1
Samisi
Otto
@mdo
2
Jakobu
Thornton
@sanra
3
Larry Eye
@twitter
<tableclass="table table-sm table-dark"><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>
Awọn kilasi asọye
Lo awọn kilasi ọrọ-ọrọ lati ṣe awọ awọn ori ila tabili tabi awọn sẹẹli kọọkan.
Kilasi
Akori
Akori
Ti nṣiṣe lọwọ
Ẹyin sẹẹli
Ẹyin sẹẹli
Aiyipada
Ẹyin sẹẹli
Ẹyin sẹẹli
Alakoko
Ẹyin sẹẹli
Ẹyin sẹẹli
Atẹle
Ẹyin sẹẹli
Ẹyin sẹẹli
Aseyori
Ẹyin sẹẹli
Ẹyin sẹẹli
Ijamba
Ẹyin sẹẹli
Ẹyin sẹẹli
Ikilo
Ẹyin sẹẹli
Ẹyin sẹẹli
Alaye
Ẹyin sẹẹli
Ẹyin sẹẹli
Imọlẹ
Ẹyin sẹẹli
Ẹyin sẹẹli
Dudu
Ẹyin sẹẹli
Ẹyin sẹẹli
<!-- On rows --><trclass="table-active">...</tr><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-active">...</td><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>
Awọn iyatọ ipilẹ tabili deede ko si pẹlu tabili dudu, sibẹsibẹ, o le lo ọrọ tabi awọn ohun elo abẹlẹ lati ṣaṣeyọri awọn aza ti o jọra.
#
Akori
Akori
1
Ẹyin sẹẹli
Ẹyin sẹẹli
2
Ẹyin sẹẹli
Ẹyin sẹẹli
3
Ẹyin sẹẹli
Ẹyin sẹẹli
4
Ẹyin sẹẹli
Ẹyin sẹẹli
5
Ẹyin sẹẹli
Ẹyin sẹẹli
6
Ẹyin sẹẹli
Ẹyin sẹẹli
7
Ẹyin sẹẹli
Ẹyin sẹẹli
8
Ẹyin sẹẹli
Ẹyin sẹẹli
9
Ẹyin sẹẹli
Ẹyin sẹẹli
<!-- On rows --><trclass="bg-primary">...</tr><trclass="bg-success">...</tr><trclass="bg-warning">...</tr><trclass="bg-danger">...</tr><trclass="bg-info">...</tr><!-- On cells (`td` or `th`) --><tr><tdclass="bg-primary">...</td><tdclass="bg-success">...</td><tdclass="bg-warning">...</td><tdclass="bg-danger">...</td><tdclass="bg-info">...</td></tr>
Gbigbe itumo si awọn imọ-ẹrọ iranlọwọ
Lilo awọ lati ṣafikun itumọ nikan n pese itọkasi wiwo, eyiti kii yoo gbe lọ si awọn olumulo ti awọn imọ-ẹrọ iranlọwọ - gẹgẹbi awọn oluka iboju. Rii daju pe alaye ti o tọka si nipasẹ awọ jẹ eyiti o han gbangba lati inu akoonu funrararẹ (fun apẹẹrẹ ọrọ ti o han), tabi pẹlu pẹlu awọn ọna omiiran, gẹgẹbi afikun ọrọ ti o farapamọ pẹlu .sr-onlykilasi naa.
Ṣẹda awọn tabili idahun nipa fifisilẹ eyikeyi .tablepẹlu .table-responsive{-sm|-md|-lg|-xl}, ṣiṣe tabili yi lọ ni ita ni aaye fifọ kọọkan max-widthti o to (ṣugbọn kii ṣe pẹlu) 576px, 768px, 992px, ati 1120px, lẹsẹsẹ.
Ṣe akiyesi pe niwọn igba ti awọn aṣawakiri ko ṣe atilẹyin
awọn ibeere ipo ipo lọwọlọwọ , a ṣiṣẹ ni ayika awọn aropin ti
min-ati awọn max-asọtẹlẹ ati awọn iwoye pẹlu awọn iwọn ida (eyiti o le waye labẹ awọn ipo kan lori awọn ẹrọ dpi giga, fun apẹẹrẹ) nipa lilo awọn iye pẹlu konge giga fun awọn afiwera wọnyi .
Awọn akọle
Awọn <caption>iṣẹ kan bi akọle fun tabili kan. O ṣe iranlọwọ fun awọn olumulo pẹlu awọn oluka iboju lati wa tabili kan ati loye ohun ti o jẹ nipa ati pinnu boya wọn fẹ ka.
Akojọ ti awọn olumulo
#
Akoko
Ikẹhin
Mu
1
Samisi
Otto
@mdo
2
Jakobu
Thornton
@sanra
3
Larry
Eye
@twitter
<tableclass="table"><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>
Awọn tabili idahun
Awọn tabili idahun gba awọn tabili laaye lati yi lọ ni ita pẹlu irọrun. Jẹ ki tabili eyikeyi ṣe idahun kọja gbogbo awọn ibudo wiwo nipa fifi ipari si .tablepẹlu .table-responsive. Tabi, mu aaye isinmi ti o pọju pẹlu eyiti o le ni tabili idahun si nipa lilo .table-responsive{-sm|-md|-lg|-xl}.
Inaro clipping/truncation
Awọn tabili idahun ṣe lilo overflow-y: hidden, eyi ti awọn agekuru kuro ni eyikeyi akoonu ti o lọ kọja isalẹ tabi awọn egbegbe oke ti tabili. Ni pataki, eyi le ge awọn akojọ aṣayan silẹ ati awọn ẹrọ ailorukọ ẹnikẹta miiran.
Nigbagbogbo idahun
Kọja gbogbo aaye fifọ, lo .table-responsivefun awọn tabili lilọ kiri ni petele.
Lo .table-responsive{-sm|-md|-lg|-xl}bi o ṣe nilo lati ṣẹda awọn tabili idahun si aaye fifọ kan pato. Lati aaye fifọ yẹn ati si oke, tabili yoo huwa deede kii yoo yi lọ ni ita.
Awọn tabili wọnyi le han fifọ titi awọn aza idahun wọn yoo waye ni awọn iwọn iwoye kan pato.