Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
File Manager
/
ONSEMI
/
Dev tableau
:
code017.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 avec Sticky Header et Sticky Colonne</title> <style> table { width: 100%; max-width: 1200px; max-height: 400px; border-collapse: collapse; overflow: auto; display: block; } th, td { padding: 10px; border: 1px solid #ccc; text-align: center; } /* Sticky Header */ th { background-color: #f2f2f2; position: sticky; top: 0; z-index: 3; } /* Sticky First Column */ td:first-child { background-color: #f2f2f2; position: sticky; left: 0; z-index: 2; border-left: 2px solid #ccc; /* Bordure gauche visible */ } /* Sticky First Cell (top-left corner) */ th:first-child { position: sticky; top: 0; left: 0; z-index: 4; /* Au-dessus des autres cellules sticky */ background-color: #f2f2f2; border-top: 2px solid #ccc; /* Bordure supérieure */ border-left: 2px solid #ccc; /* Bordure gauche */ } /* Pour éviter que la bordure gauche de la première colonne ne soit masquée */ td:first-child { z-index: 2; } /* Défilement du tableau */ .table-wrapper { overflow: auto; max-height: 400px; } </style> </head> <body> <div class="table-wrapper"> <table> <thead> <tr> <th></th> <!-- Création des en-têtes de colonnes (50 colonnes) --> <?php for ($i = 1; $i <= 50; $i++): ?> <th>Col <?php echo $i; ?></th> <?php endfor; ?> </tr> </thead> <tbody> <!-- Création des lignes --> <?php for ($i = 1; $i <= 50; $i++): ?> <tr> <td>Row <?php echo $i; ?></td> <!-- Création des cellules de données --> <?php for ($j = 1; $j <= 50; $j++): ?> <td>Data <?php echo $i . "-" . $j; ?></td> <?php endfor; ?> </tr> <?php endfor; ?> </tbody> </table> </div> </body> </html>