Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
File Manager
/
Dev tableau
:
code061.php
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
<!DOCTYPE html> <html lang="fr"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Tableau Sticky avec Bordures Fixes</title> <style> /* Conteneur pour permettre le défilement horizontal et vertical */ .table-wrapper { width: 100%; max-height: 400px; overflow: auto; border: 1px solid #ccc; scroll-snap-type: both mandatory; position: relative; } table { width: max-content; border-collapse: collapse; } th, td { padding: 10px; text-align: center; vertical-align: middle; border: 1px solid #ccc; min-width: 120px; height: 40px; box-sizing: border-box; } /* En-têtes sticky - toutes les cellules de la première ligne */ th { background-color: #f2f2f2; position: sticky; top: 0; z-index: 10; border-bottom: 2px solid #aaa; } /* Première colonne sticky */ th:first-child, td:first-child { position: sticky; left: 0; background-color: white; z-index: 20; border-right: 2px solid #ccc; min-width: 120px; box-sizing: border-box; border-left: 2px solid #ccc; /* Bordure gauche visible */ } /* Deuxième colonne sticky */ th:nth-child(2), td:nth-child(2) { position: sticky; left: 120px; background-color: white; z-index: 19; border-right: 2px solid #ccc; min-width: 120px; box-sizing: border-box; border-left: 2px solid #ccc; /* Bordure gauche visible */ } /* Troisième colonne sticky */ th:nth-child(3), td:nth-child(3) { position: sticky; left: 240px; background-color: white; z-index: 18; border-right: 2px solid #ccc; min-width: 120px; box-sizing: border-box; border-left: 2px solid #ccc; /* Bordure gauche visible */ } /* Alternance des couleurs pour lisibilité */ tbody tr:nth-child(odd) { background-color: #f9f9f9; } /* Rendre sticky le coin supérieur gauche */ th:first-child { position: sticky; top: 0; left: 0; z-index: 30; background-color: #ddd; border-bottom: 2px solid #aaa; } </style> </head> <body> <div class="table-wrapper"> <table> <thead> <tr> <th></th> <!-- Coin supérieur gauche --> <th>plouf</th> <!-- Deuxième colonne sticky --> <th>cretin</th> <!-- Troisième colonne sticky --> <?php for ($i = 1; $i <= 50; $i++): ?> <th>Col <?php echo $i; ?></th> <?php endfor; ?> </tr> </thead> <tbody> <?php for ($i = 1; $i <= 50; $i++): ?> <tr> <td>Row <?php echo $i; ?></td> <td>Data <?php echo $i; ?>-1</td> <td>Data <?php echo $i; ?>-2</td> <?php for ($j = 1; $j <= 50; $j++): ?> <td>Data <?php echo $i . "-" . ($j + 2); ?></td> <?php endfor; ?> </tr> <?php endfor; ?> </tbody> </table> </div> </body> </html>