Dokumintaasje en foarbylden foar opt-in styling fan tabellen (jûn har foarkommende gebrûk yn JavaScript-plugins) mei Bootstrap.
Foarbylden
Fanwegen it wiidferspraat gebrûk fan tabellen oer widgets fan tredden lykas kalinders en datumkiezers, hawwe wy ús tabellen ûntworpen om oan te melden . Foegje gewoan de basisklasse .tableta oan elke <table>, wreidzje dan út mei oanpaste stilen as ús ferskate ynbegrepen modifierklassen.
Mei help fan de meast basale tabelmarkearring, hjir is hoe .table-basearre tabellen der útsjen yn Bootstrap. Alle tabelstilen binne erfd yn Bootstrap 4 , wat betsjut dat alle nestede tabellen op deselde manier wurde stylearre as de âlder.
Foegje .table-borderedfoar grinzen oan alle kanten fan 'e tafel en sellen.
#
Earste
Lêst
Handle
1
Merk
Otto
@mdo
2
Jacob
Thornton
@fet
3
Larry de Fûgel
@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>
#
Earste
Lêst
Handle
1
Merk
Otto
@mdo
2
Jacob
Thornton
@fet
3
Larry de Fûgel
@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>
Borderless tafel
Add .table-borderlessfoar in tafel sûnder grinzen.
#
Earste
Lêst
Handle
1
Merk
Otto
@mdo
2
Jacob
Thornton
@fet
3
Larry de Fûgel
@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-borderlesskin ek brûkt wurde op tsjustere tafels.
#
Earste
Lêst
Handle
1
Merk
Otto
@mdo
2
Jacob
Thornton
@fet
3
Larry de Fûgel
@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 rigen
Foegje .table-hoverta om in hoverstatus yn te skeakeljen op tabelrijen binnen in <tbody>.
#
Earste
Lêst
Handle
1
Merk
Otto
@mdo
2
Jacob
Thornton
@fet
3
Larry de Fûgel
@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>
#
Earste
Lêst
Handle
1
Merk
Otto
@mdo
2
Jacob
Thornton
@fet
3
Larry de Fûgel
@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>
Lytse tafel
Foegje .table-smta om tabellen kompakter te meitsjen troch selpadding yn 'e helte te snijen.
#
Earste
Lêst
Handle
1
Merk
Otto
@mdo
2
Jacob
Thornton
@fet
3
Larry de Fûgel
@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>
#
Earste
Lêst
Handle
1
Merk
Otto
@mdo
2
Jacob
Thornton
@fet
3
Larry de Fûgel
@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>
Kontekstuele klassen
Brûk kontekstuele klassen om tabelrijen of yndividuele sellen te kleurjen.
Klasse
Heading
Heading
Aktyf
Sel
Sel
Standert
Sel
Sel
Primêr
Sel
Sel
Sekundêr
Sel
Sel
Sukses
Sel
Sel
Gefaar
Sel
Sel
Warskôging
Sel
Sel
Info
Sel
Sel
Ljocht
Sel
Sel
Tsjuster
Sel
Sel
<!-- 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>
Gewoane tabel eftergrûn farianten binne net beskikber mei de tsjustere tafel, lykwols, jo meie gebrûk meitsje fan tekst of eftergrûn nutsbedriuwen te berikken ferlykbere stilen.
#
Heading
Heading
1
Sel
Sel
2
Sel
Sel
3
Sel
Sel
4
Sel
Sel
5
Sel
Sel
6
Sel
Sel
7
Sel
Sel
8
Sel
Sel
9
Sel
Sel
<!-- 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>
Betsjutting oerbringe oan assistinte technologyen
It brûken fan kleur om betsjutting ta te foegjen jout allinich in fisuele yndikaasje, dy't net sil wurde oerbrocht oan brûkers fan assistinte technologyen - lykas skermlêzers. Soargje derfoar dat ynformaasje oanjûn troch de kleur óf dúdlik is út de ynhâld sels (bgl. de sichtbere tekst), óf wurdt opnommen troch alternative middels, lykas ekstra tekst ferburgen mei de .sr-onlyklasse.
Meitsje responsive tabellen troch elk .tablemei te wikkeljen .table-responsive{-sm|-md|-lg|-xl}, wêrtroch't de tabel horizontaal rôlje by elk max-widthbrekpunt fan oant (mar net ynklusyf) respektivelik 576px, 768px, 992px en 1120px.
Tink derom dat, om't browsers op it stuit gjin berikkontekstfragen stypje
, wurkje wy om de beheiningen fan
min-en max-foarheaksels en viewports mei fraksjonele breedtes (wat kinne foarkomme ûnder bepaalde betingsten op apparaten mei hege dpi, bygelyks) troch wearden mei hegere presyzje te brûken foar dizze fergelikingen .
Captions
A <caption>funksjonearret as in kop foar in tabel. It helpt brûkers mei skermlêzers om in tabel te finen en te begripen wêr't it oer giet en beslute as se it lêze wolle.
List fan brûkers
#
Earste
Lêst
Handle
1
Merk
Otto
@mdo
2
Jacob
Thornton
@fet
3
Larry
de fûgel
@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>
Responsive tabellen
Responsive tabellen kinne tabellen mei gemak horizontaal rôlje. Meitsje eltse tafel responsyf oer alle viewports troch wrapping in .tablemei .table-responsive. Of kies in maksimale brekpunt wêrmei't jo in responsive tabel moatte hawwe mei .table-responsive{-sm|-md|-lg|-xl}.
Fertikale clipping / trunkaasje
Responsive tabellen meitsje gebrûk fan overflow-y: hidden, dy't elke ynhâld ôfknipt dy't boppe de ûnder- of bopperâne fan 'e tabel giet. Dit kin benammen dropdownmenu's en oare widgets fan tredden ôfknippe.
Altyd responsyf
Brûk elk brekpunt .table-responsivefoar horizontaal rôljen fan tabellen.
Brûk .table-responsive{-sm|-md|-lg|-xl}as nedich om responsive tabellen te meitsjen oant in bepaald brekpunt. Fan dat brekpunt en omheech, sil de tabel normaal gedrage en net horizontaal rôlje.
Dizze tabellen kinne brutsen ferskine oant har responsive stilen jilde op spesifike sichtportbreedtes.