[CSS]Table scrollable version display:sticky
Table scrollable verticalement (Non compatible IExplorer)
Structure HTML de base
<div class="cadre-table-scroll">
<table class="table-scroll">
<thead>
<tr>
<th></th> <th></th> <th></th>
</tr>
</thead>
<tbody>
<tr>
<td></td> <td></td> <td></td>
</tr>
<!-- la suite des données de la table -->
</tbody>
<tfoot>
<tr>
<td colspan="5"></td>
</tr>
</tfoot>
</table>
</div>
La <table>
est placée dans un conteneur, ici une <div>
, afin de définir la hauteur d'affichage pour celle-ci.
Le rendu
Prénom | Nom | Date | Entreprise | Fonction |
---|---|---|---|---|
Patricia | Ray | 05/01/1981 | Gevee | Mechanical Systems Engineer |
James | Thomas | 01/30/1978 | Skynoodle | Nurse Practicioner |
Gerald | Hawkins | 01/22/1981 | Voonix | Nurse Practicioner |
Gary | Hamilton | 08/19/1981 | Zoombox | Administrative Officer |
Sarah | Fernandez | 04/13/1974 | Pixoboo | Payment Adjustment Coordinator |
Brenda | Carpenter | 07/01/1978 | Avaveo | Staff Accountant II |
Joan | Alvarez | 06/25/1966 | Zazio | Associate Professor |
Wanda | Hanson | 11/04/1984 | Brightdog | Compensation Analyst |
Martin | Taylor | 02/17/1969 | Youspan | Engineer III |
Beverly | Stanley | 11/25/1970 | Dabtype | Assistant Media Planner |
Christoph | Casbourne | 9/13/1957 | Tejon Ranch Co | Services |
Truda | Bertelmot | 11/11/1985 | Clipper Realty Inc. | Accounting |
Dallon | Goulding | 3/16/1977 | Goldman Sachs Group, Inc. (The) | Research and Development |
Yoshiko | Danielsky | 7/10/1997 | FB Financial Corporation | Business Development |
Berte | Dmitrienko | 11/17/1995 | Argan, Inc. | Marketing |
Valentijn | Meadmore | 8/2/1993 | MGM Resorts International | Human Resources |
Suzy | Flewett | 10/25/1980 | Ceragon Networks Ltd. | Research and Development |
Mordecai | Jerrams | 10/13/1965 | Silicom Ltd | Training |
Claus | Samwyse | 11/25/1974 | Verizon Communications Inc. | Accounting |
Rafaelia | Pedrol | 4/18/1975 | Schneider National, Inc. | Research and Development |
Lita | Lisimore | 6/8/1988 | Simmons First National Corporation | Product Management |
Noak | McPeice | 12/6/1974 | Eyegate Pharmaceuticals, Inc. | Product Management |
Craggy | Portugal | 12/18/1989 | Roper Technologies, Inc. | Sales |
Madelle | Bartoszinski | 12/20/1958 | Honeywell International Inc. | Legal |
Frasquito | Harriagn | 9/24/1998 | ASB Bancorp, Inc. | Accounting |
Betteann | Freegard | 5/5/1954 | Brookfield Property Partners L.P. | Marketing |
Jacinda | Sheepy | 10/22/1989 | Landmark Infrastructure Partners LP | Engineering |
Sigismund | Arnholtz | 9/16/1965 | Ellington Residential Mortgage REIT | Research and Development |
Myrle | Cromack | 5/7/1951 | First Cash, Inc. | Research and Development |
Zorina | Momford | 11/1/1961 | Cimpress N.V | Marketing |
Ceci n'est qu'un <tfoot>. |
Le CSS pour le scroll
/*-- pour scroll actif --*/
.cadre-table-scroll {
display: inline-block;
height: 20em;
overflow-y: scroll;
}
.table-scroll thead th {
position: sticky;
top: 0;
}
.table-scroll tfoot td {
position: sticky;
bottom: 0;
}
Le CSS cosmétique
Le CSS suivant est juste là pour « styler » la <table>
.
.table-scroll {
}