<!DOCTYPE html> <html lang="fr"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Tableau HTML</title> <style> .table-container { width: 100%; overflow-x: auto; position: relative; } table { border-collapse: collapse; white-space: nowrap; } th, td { border: 1px solid black; padding: 5px; text-align: center; } /* Colonne fixe (sticky) */ .fixed-column { position: sticky; left: 0; background-color: white; z-index: 2; box-shadow: -1px 0 0 black; /* Bordure persistante à gauche */ padding-left: 18px; /* Décalage du texte */ text-align: left; } /* Assurez-vous que la première colonne a une largeur fixe */ td.fixed-column { width: 222px; min-width: 222px; max-width: 222px; } /* Ajustement des bordures des autres colonnes */ td:not(.fixed-column), th:not(.fixed-column) { border-left: 1px solid black; } </style> </head> <body> <div class="table-container"> <table> <?php $rows = ['toto', 'titi', 'lulu']; $columns = 200; foreach ($rows as $row) { echo "<tr>"; echo "<td class='fixed-column'>$row</td>"; // Première colonne fixe for ($i = 0; $i < $columns; $i++) { echo "<td>0</td>"; // Autres colonnes } echo "</tr>"; } ?> </table> </div> </body> </html>