<h2>Responsive Tables #2: Flexbox</h2>

<table>
    <thead>
        <tr>
            <th>Type of Food</th>
            <th>Calories</th>
            <th>Tasty Factor</th>
            <th>Average Price</th>
            <th>Rarity</th>
            <th>Average Rating</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>Slice of Pizza</td>
            <td>450</td>
            <td>95%</td>
            <td>$5.00</td>
            <td>Common</td>
            <td>8/10</td>
        </tr>
        <tr>
            <td>Hamburger</td>
            <td>350</td>
            <td>87%</td>
            <td>$3.50</td>
            <td>Common</td>
            <td>7.5/10</td>
        </tr>
    </tbody>
</table>
* {
    box-sizing: border-box;
    font-family: "Avenir", "Helvetica", sans-serif;
}

body {
    background-color: #f9f9f9;
}

/* Default table styles for this demo */
table {
    border-collapse: collapse;
    text-align: left;
    width: 100%;
}
table tr {
    background: white;
    border-bottom: 1px solid
}
table th, table td {
    padding: 10px 20px;
}

/* Simple CSS for flexbox table on mobile */
@media(max-width: 800px) {
    table thead {
        left: -9999px;
        position: absolute;
        visibility: hidden;
    }
    table tr {
        border-bottom: 0;
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        margin-bottom: 40px;
    }
    table td {
        border: 1px solid;
        margin: 0 -1px -1px 0;
        width: 50%;
    }
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.