File "table0010.php"

Full Path: /home/analogde/www/Dev tableau/table0010.php
File size: 2.46 KB
MIME-type: text/html
Charset: utf-8

<!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 {
            display: flex;
            overflow-x: auto;
        }
        .table {
            border-collapse: collapse;
            white-space: nowrap;
        }
        th, td {
            border: 1px solid black;
            padding: 5px;
            text-align: center;
        }

        /* Conteneur pour la première colonne */
        .fixed-column-container {
            position: sticky;
            left: 0;
            top: 0;
            z-index: 2;
            background-color: white;
            box-shadow: -1px 0 0 black; /* Bordure persistante à gauche */
            width: 222px;
            min-width: 222px;
            max-width: 222px;
            text-align: left;
            padding-left: 18px; /* Décalage du texte */
        }

        .fixed-column {
            padding-left: 18px; /* Décalage du texte */
        }

        /* Table principale avec les autres colonnes */
        .main-table {
            overflow-x: auto;
        }

        td.fixed-column {
            width: 222px;
            min-width: 222px;
            max-width: 222px;
        }

        /* Style pour les cellules et les bordures */
        .main-table td {
            border-left: 1px solid black;
        }
    </style>
</head>
<body>
    <div class="table-container">
        <!-- Colonne fixe -->
        <div class="fixed-column-container">
            <table class="table">
                <?php 
                    $rows = ['toto', 'titi', 'lulu'];
                    foreach ($rows as $row) {
                        echo "<tr><td class='fixed-column'>$row</td></tr>";
                    }
                ?>
            </table>
        </div>

        <!-- Table avec le reste des colonnes -->
        <div class="main-table">
            <table class="table">
                <?php 
                    $columns = 200; 
                    foreach ($rows as $row) {
                        echo "<tr>";
                        for ($i = 0; $i < $columns; $i++) {
                            echo "<td>0</td>";
                        }
                        echo "</tr>";
                    }
                ?>
            </table>
        </div>
    </div>
</body>
</html>