CSS: table
.instui-table — Stilizált adattábla a th és td számára, opcionális felirattal, lebegtetéses, rögzített és halmozott kártya elrendezésekkel.
A -layout-stacked esetén a tiszta CSS nem húzhatja az egyes oszlop fejléc szövegét a cellájába, ezért adjon minden cellának egy data-label értéket, és a halmozott kártya megjeleníti a ::before segítségével.
Forrás: table.css
Akadálymentesség
Jelölje meg a táblázatot egy <caption> segítségével, az oszlop fejléceket <th scope="col">-nek, a sor fejléceket <th scope="row">-nek jelölje, és a -layout-stacked-ben adjon minden cellának egy data-label értéket, mivel a fejléc sor vizuálisan rejtett.
Használat
css
@import "@pantoken/components/components.css";
@import "@pantoken/components/table.css";Példák
html
<table class="instui-table -hover">
<caption>Top-rated films</caption>
<thead>
<tr>
<th scope="col">Rank</th>
<th scope="col">Title</th>
<th scope="col">Year</th>
<th scope="col">Rating</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td>The Shawshank Redemption</td>
<td>1994</td>
<td>9.3</td>
</tr>
<tr>
<th scope="row">2</th>
<td>The Godfather</td>
<td>1972</td>
<td>9.2</td>
</tr>
<tr>
<th scope="row">3</th>
<td>The Godfather: Part II</td>
<td>1974</td>
<td>9.0</td>
</tr>
</tbody>
</table>| Rank | Title | Year | Rating |
|---|---|---|---|
| 1 | The Shawshank Redemption | 1994 | 9.3 |
| 2 | The Godfather | 1972 | 9.2 |
| 3 | The Godfather: Part II | 1974 | 9.0 |
Felépítés
text
.instui-table.-hover
caption
thead
tr
th
tbody
tr
th
tdflowchart TD
n0[".instui-table.-hover"]:::cssdoc-root
n1("caption"):::cssdoc-part
n2("thead"):::cssdoc-part
n3("tr"):::cssdoc-part
n4("th"):::cssdoc-part
n5("tbody"):::cssdoc-part
n6("tr"):::cssdoc-part
n7("th"):::cssdoc-part
n8("td"):::cssdoc-part
n0 --> n1
n3 --> n4
n2 --> n3
n0 --> n2
n6 --> n7
n6 --> n8
n5 --> n6
n0 --> n5
classDef cssdoc-root stroke-width:1px;
classDef cssdoc-part stroke-width:1px;
classDef cssdoc-slot stroke-width:1px;
classDef cssdoc-component stroke-width:1px;
Módosítók
| Módosító | Leírás |
|---|---|
.-hover | Sorok kiemelése lebegtetéskor. |
.-layout-fixed | Rögzített táblázatelrendezés (egyenlő szélességű oszlopok). |
.-layout-stacked | Az egyes sorokat kártyaként halmozza fel cellánként data-label segítségével. |
Pszeudoelemek
| Pszeudoelem | Leírás |
|---|---|
::before | Az egyes cellák data-label értékét az oszlop fejlécként jeleníti meg a halmozott elrendezésben. |
Felhasznált tokenek
| Token | Típus | Érték |
|---|---|---|
--instui-border-width-md | <length> | 0.125rem |
--instui-border-width-sm | <length> | 0.0625rem |
--instui-component-table-background | <color> | light-dark(#ffffff, #10141A)LightDark |
--instui-component-table-cell-color | <color> | light-dark(#273540, #F2F4F5)LightDark |
--instui-component-table-cell-line-height | <percentage> | 125% |
--instui-component-table-cell-padding-horizontal | <length> | 0.75rem |
--instui-component-table-cell-padding-vertical | <length> | 0.5rem |
--instui-component-table-col-header-background | <color> | light-dark(#ffffff, #10141A)LightDark |
--instui-component-table-col-header-color | <color> | light-dark(#273540, #F2F4F5)LightDark |
--instui-component-table-col-header-line-height | <percentage> | 125% |
--instui-component-table-col-header-padding-horizontal | <length> | 0.75rem |
--instui-component-table-col-header-padding-vertical | <length> | 0.5rem |
--instui-component-table-color | <color> | light-dark(#273540, #ffffff)LightDark |
--instui-component-table-font-family | [ <font-family-name> | <generic-font-family> ]# | Atkinson Hyperlegible Next, "Helvetica Neue", Helvetica, Arial, sans-serif |
--instui-component-table-font-size | <length> | 1rem |
--instui-component-table-head-background | <color> | light-dark(#ffffff, #10141A)LightDark |
--instui-component-table-head-font-weight | <integer> | 600 |
--instui-component-table-row-border-color | <color> | light-dark(#8D959F, #6A7883)LightDark |
--instui-component-table-row-header-background | <color> | light-dark(#ffffff, #10141A)LightDark |
--instui-component-table-row-header-color | <color> | light-dark(#273540, #F2F4F5)LightDark |
--instui-component-table-row-header-font-weight | <integer> | 400 |
--instui-component-table-row-header-line-height | <percentage> | 125% |
--instui-component-table-row-header-padding-horizontal | <length> | 0.75rem |
--instui-component-table-row-header-padding-vertical | <length> | 0.5rem |
--instui-component-table-row-hover-border-color | <color> | light-dark(#1D354F, #EEF4FD)LightDark |
--instui-component-table-row-padding-horizontal | <length> | 0rem |
--instui-component-table-row-padding-vertical | <length> | 0.5rem |