Bootstrap 4 Stoły
Bootstrap 4 Podstawowy stół
Podstawowy stół Bootstrap 4 ma lekką wyściółkę i poziome przegrody.
Klasa .table
dodaje podstawową stylizację do tabeli:
Przykład
Firstname | Lastname | |
---|---|---|
John | Doe | [email protected] |
Mary | Moe | [email protected] |
July | Dooley | [email protected] |
Pasiaste rzędy
Klasa .table-striped
dodaje do tabeli paski zebry:
Przykład
Firstname | Lastname | |
---|---|---|
John | Doe | [email protected] |
Mary | Moe | [email protected] |
July | Dooley | [email protected] |
Stół z obramowaniem
Klasa .table-bordered
dodaje obramowania ze wszystkich stron tabeli i komórek:
Przykład
Firstname | Lastname | |
---|---|---|
John | Doe | [email protected] |
Mary | Moe | [email protected] |
July | Dooley | [email protected] |
Wskaż wiersze
Klasa .table-hover
dodaje efekt najechania (szare tło) w wierszach tabeli:
Przykład
Firstname | Lastname | |
---|---|---|
John | Doe | [email protected] |
Mary | Moe | [email protected] |
July | Dooley | [email protected] |
Czarny/Ciemny Stół
Klasa .table-dark
dodaje do stołu czarne tło:
Przykład
Firstname | Lastname | |
---|---|---|
John | Doe | [email protected] |
Mary | Moe | [email protected] |
July | Dooley | [email protected] |
Stół w ciemne paski
Połącz .table-dark
i .table-striped
stwórz ciemny stół w paski:
Przykład
Firstname | Lastname | |
---|---|---|
John | Doe | [email protected] |
Mary | Moe | [email protected] |
July | Dooley | [email protected] |
Unoszący się ciemny stół
Klasa .table-hover
dodaje efekt najechania (szare tło) w wierszach tabeli:
Przykład
Firstname | Lastname | |
---|---|---|
John | Doe | [email protected] |
Mary | Moe | [email protected] |
July | Dooley | [email protected] |
Stół bez obramowania
Klasa .table-borderless
usuwa obramowania z tabeli:
Przykład
Firstname | Lastname | |
---|---|---|
John | Doe | [email protected] |
Mary | Moe | [email protected] |
July | Dooley | [email protected] |
Klasy kontekstowe
Za pomocą klas kontekstowych można pokolorować całą tabelę ( <table>
), wiersze tabeli ( <tr>
) lub komórki tabeli ( <td>
).
Przykład
Firstname | Lastname | |
---|---|---|
Default | Defaultson | [email protected] |
Primary | Joe | [email protected] |
Success | Doe | [email protected] |
Danger | Moe | [email protected] |
Info | Dooley | [email protected] |
Warning | Refs | [email protected] |
Active | Activeson | [email protected] |
Secondary | Secondson | [email protected] |
Light | Angie | [email protected] |
Dark | Bo | [email protected] |
Klasy kontekstowe, których można użyć to:
Klasa | Opis |
---|---|
.table-primary |
Niebieski: oznacza ważną czynność |
.table-success |
Zielony: oznacza udane lub pozytywne działanie |
.table-danger |
Czerwony: oznacza niebezpieczne lub potencjalnie negatywne działanie |
.table-info |
Jasnoniebieski: wskazuje neutralną zmianę informacyjną lub działanie |
.table-warning |
Pomarańczowy: oznacza ostrzeżenie, które może wymagać uwagi |
.table-active |
Szary: stosuje kolor najechania kursorem na wiersz tabeli lub komórkę tabeli |
.table-secondary |
Szary: oznacza nieco mniej ważną czynność |
.table-light |
Jasnoszary stół lub tło rzędu stołu |
.table-dark |
Ciemnoszary stół lub tło rzędu stołu |
Kolory główek stołu
Klasa .thead-dark
dodaje czarne tło do nagłówków tabel, a .thead-light
klasa dodaje szare tło do nagłówków tabel:
Przykład
Firstname | Lastname | |
---|---|---|
John | Doe | [email protected] |
Mary | Moe | [email protected] |
July | Dooley | [email protected] |
Firstname | Lastname | |
---|---|---|
John | Doe | [email protected] |
Mary | Moe | [email protected] |
July | Dooley | [email protected] |
Mały stół
Klasa .table-sm
zmniejsza stół, przecinając wypełnienie komórek na pół:
Przykład
Firstname | Lastname | |
---|---|---|
John | Doe | [email protected] |
Mary | Moe | [email protected] |
July | Dooley | [email protected] |
Responsywne tabele
Klasa .table-responsive
dodaje pasek przewijania do tabeli w razie potrzeby (gdy jest za duży w poziomie):
Przykład
<div class="table-responsive">
<table class="table">
...
</table>
</div>
Możesz także zdecydować, kiedy w tabeli powinien pojawić się pasek przewijania, w zależności od szerokości ekranu:
Klasa | Szerokość ekranu |
---|---|
.table-responsive-sm |
< 576 pikseli |
.table-responsive-md |
<768px |
.table-responsive-lg |
<992px |
.table-responsive-xl |
< 1200 pikseli |
Przykład
<div class="table-responsive-sm">
<table class="table">
...
</table>
</div>