Skip to content

CSS: table

.instui-table — Yon tab done estilize pou th ak td, plis yon caption opsyonèl, ak efè hover, layout fiks, ak aranjman kat anpile.

Pou -layout-stacked, CSS pwòp pa ka rale tèks chak kolòn header nan selil li, kidonk bay chak selil yon data-label epi kat anpile a montre li atravè ::before. Gade manm table.head, table.body, table.row, table.cell, table.col-header, ak table.row-header pou pati endividyèl yo.

Source: body.css

Aksè

Mete yon <caption> kòm etikèt tab la, make header kolòn yo kòm <th scope="col"> ak header ranje yo kòm <th scope="row">, epi nan -layout-stacked bay chak selil yon data-label paske ranje header la kache vizyèlman.

Itilizasyon

css
@import "@pantoken/components/components.css";
@import "@pantoken/components/table.css";

Egzanp

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>

Estrikti

text
.instui-table.-hover
  caption
  thead
    th
  tbody
    tr
      td, th[scope="row"]
flowchart TD n0[".instui-table.-hover"]:::cssdoc-root n1("caption"):::cssdoc-part n2("thead"):::cssdoc-part n3("th"):::cssdoc-part n4("tbody"):::cssdoc-part n5("tr"):::cssdoc-part n6("td, th[scope=&quot;row&quot;]"):::cssdoc-part n0 --> n1 n2 --> n3 n0 --> n2 n5 --> n6 n4 --> n5 n0 --> n4 classDef cssdoc-root stroke-width:1px; classDef cssdoc-part stroke-width:1px; classDef cssdoc-slot stroke-width:1px; classDef cssdoc-component stroke-width:1px;

Modifikatè

ModifikatèDeskripsyon
.-hoverMete aksan sou ranje lè w pase sourit la. @affects table.row — Rezève epi kolore bor hover ranje a.
.-layout-fixedLayout tab fiks (kolòn egal lajè).
.-layout-stackedAnpile chak ranje kòm yon kat, atravè yon data-label pou chak selil. @affects table.head @affects table.body @affects table.row @affects table.cell @affects table.col-header @affects table.row-header — Anpile chak pati kòm yon blòk epi kache/etikèt header la kòmsadwa.

Pati

PatiDeskripsyon
.captionYon caption tab opsyonèl.

Tokens konsome

TokenTipValè
--instui-component-table-background<color>LightDarklight-dark(#ffffff, #10141A)
--instui-component-table-cell-padding-horizontal<length>0.75rem
--instui-component-table-cell-padding-vertical<length>0.5rem
--instui-component-table-col-header-color<color>LightDarklight-dark(#273540, #F2F4F5)
--instui-component-table-color<color>LightDarklight-dark(#273540, #ffffff)
--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-font-weight<integer>600

Sou-konpozan