Dokuméntasi sareng conto pikeun milih gaya tabel (dibikeun panggunaan umumna dina plugins JavaScript) sareng Bootstrap.
Contona
Kusabab pamakean tabel anu nyebar dina widget pihak katilu sapertos almenak sareng pamilih tanggal, kami parantos ngararancang tabel kami pikeun milih . Ngan tambahkeun kelas dasar .tablekana naon waé <table>, teras manjangkeun ku gaya khusus atanapi sababaraha kelas modifier anu kalebet.
Nganggo markup tabel anu paling dasar, ieu kumaha .tabletabel dumasar kana Bootstrap. Sadaya gaya méja diwariskeun dina Bootstrap 4 , hartosna tabel anu aya dina gaya anu sami sareng indungna.
Tambahkeun .table-borderedpikeun wates dina sagala sisi tabel sarta sél.
#
kahiji
Panungtungan
Nanganan
1
Tandaan
Otto
@mdo
2
Yakub
Thornton
@gajih
3
Larry Manuk
@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>
#
kahiji
Panungtungan
Nanganan
1
Tandaan
Otto
@mdo
2
Yakub
Thornton
@gajih
3
Larry Manuk
@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>
Méja tanpa wates
Tambahkeun .table-borderlesspikeun méja tanpa wates.
#
kahiji
Panungtungan
Nanganan
1
Tandaan
Otto
@mdo
2
Yakub
Thornton
@gajih
3
Larry Manuk
@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-borderlessogé bisa dipaké dina tabel poék.
#
kahiji
Panungtungan
Nanganan
1
Tandaan
Otto
@mdo
2
Yakub
Thornton
@gajih
3
Larry Manuk
@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>
Jajaran hoverable
Tambahkeun .table-hoverpikeun ngaktipkeun kaayaan hover dina baris tabel dina hiji <tbody>.
#
kahiji
Panungtungan
Nanganan
1
Tandaan
Otto
@mdo
2
Yakub
Thornton
@gajih
3
Larry Manuk
@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>
#
kahiji
Panungtungan
Nanganan
1
Tandaan
Otto
@mdo
2
Yakub
Thornton
@gajih
3
Larry Manuk
@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>
méja leutik
Tambahkeun .table-smsangkan tabel leuwih kompak ku motong padding sél dina satengah.
#
kahiji
Panungtungan
Nanganan
1
Tandaan
Otto
@mdo
2
Yakub
Thornton
@gajih
3
Larry Manuk
@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>
#
kahiji
Panungtungan
Nanganan
1
Tandaan
Otto
@mdo
2
Yakub
Thornton
@gajih
3
Larry Manuk
@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>
Kelas kontekstual
Anggo kelas kontekstual pikeun ngawarnaan baris tabel atanapi sél individu.
Kelas
Judul
Judul
Aktip
Sél
Sél
Default
Sél
Sél
primér
Sél
Sél
Sekunder
Sél
Sél
Kasuksésan
Sél
Sél
Bahaya
Sél
Sél
Awas
Sél
Sél
Inpo
Sél
Sél
Caang
Sél
Sél
Poek
Sél
Sél
<!-- 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>
Varian latar tukang tabel biasa henteu sayogi sareng méja poék, tapi anjeun tiasa nganggo téks atanapi latar tukang pikeun ngahontal gaya anu sami.
#
Judul
Judul
1
Sél
Sél
2
Sél
Sél
3
Sél
Sél
4
Sél
Sél
5
Sél
Sél
6
Sél
Sél
7
Sél
Sél
8
Sél
Sél
9
Sél
Sél
<!-- 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>
Nepikeun harti kana téknologi anu ngabantosan
Ngagunakeun warna pikeun nambahkeun harti ngan nyadiakeun indikasi visual, nu moal conveyed ka pamaké tina téhnologi mantuan - kayaning pamiarsa layar. Pastikeun yén inpormasi anu dilambangkeun ku warna écés tina eusina sorangan (contona téks anu katingali), atanapi kalebet dina cara alternatif, sapertos téks tambahan disumputkeun sareng .sr-onlykelas.
Jieun tabel responsif ku wrapping sagala .tablekalawan .table-responsive{-sm|-md|-lg|-xl}, sahingga tabel ngagulung horisontal di unggal max-widthbreakpoint nepi ka (tapi teu kaasup) 576px, 768px, 992px, jeung 1120px, masing-masing.
Catet yén kumargi browser ayeuna henteu ngadukung
patarosan kontéks rentang , urang ngerjakeun watesan
min-sareng max-awalan sareng viewports kalayan rubak fraksional (anu tiasa lumangsung dina kaayaan anu tangtu dina alat-alat dpi luhur, contona) ku ngagunakeun nilai-nilai anu akurasi anu langkung luhur pikeun babandingan ieu. .
Captions
A <caption>fungsi kawas judul pikeun méja. Éta ngabantosan pangguna anu maca layar pikeun mendakan méja sareng ngartos naon éta sareng mutuskeun upami aranjeunna hoyong maca éta.
Daptar pamaké
#
kahiji
Panungtungan
Nanganan
1
Tandaan
Otto
@mdo
2
Yakub
Thornton
@gajih
3
Larry
manuk
@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>
tabél responsif
Tabel responsif ngamungkinkeun tabel pikeun ngagulung sacara horisontal kalayan gampang. Jieun tabel naon responsif peuntas sagala viewports ku wrapping a .tablekalawan .table-responsive. Atanapi, pilih titik putus maksimal pikeun ngagaduhan méja responsif ku ngagunakeun .table-responsive{-sm|-md|-lg|-xl}.
Clipping nangtung / truncation
tabél responsif ngagunakeun overflow-y: hidden, nu klip kaluar sagala eusi nu mana saluareun edges handap atawa luhur tabél. Khususna, ieu tiasa motong ménu lungsur sareng widget pihak katilu anu sanés.
Salawasna responsif
Di sakuliah unggal breakpoint, pake .table-responsivepikeun tabel ngagulung horizontal.
Paké .table-responsive{-sm|-md|-lg|-xl}sakumaha diperlukeun pikeun nyieun tabel responsif nepi ka breakpoint tinangtu. Ti breakpoint éta sarta nepi, tabél bakal kalakuanana normal teu ngagulung horisontal.
Tabél ieu tiasa katingali rusak dugi ka gaya responsifna dilarapkeun dina lebar viewport khusus.