JSFiddle - React, Tailwind, and code Playground

by jarhar

HTML

<p>I coped this table from <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/colgroup">mdn</a></p>

<table>
    <caption>Superheros and sidekicks</caption>
    <colgroup>
        <col>
        <col span="2" class="batman">
        <col span="2" class="flash">
    </colgroup>
    <tr>
        <td> </td>
        <th scope="col">Batman</th>
        <th scope="col">Robin</th>
        <th scope="col">The Flash</th>
        <th scope="col">Kid Flash</th>
    </tr>
    <tr>
        <th scope="row">Skill</th>
        <td>Smarts</td>
        <td>Dex, acrobat</td>
        <td>Super speed</td>
        <td>Super speed</td>
    </tr>
</table>

<div id=output></div>

CSS

.batman {
    background-color: #d7d9f2;
}

.flash {
    background-color: #ffe8d4;
}

caption {
    padding: 8px;
    caption-side: bottom;
}

table {
    border-collapse: collapse;
    border: 2px solid rgb(100, 100, 100);
    letter-spacing: 1px;
    font-family: sans-serif;
    font-size: .7rem;
}

td,
th {
    border: 1px solid rgb(100, 100, 100);
    padding: 10px 10px;
}

td {
    text-align: center;
}

JavaScript

const colgroup = document.querySelector('colgroup');
colgroup.setAttribute('hidden', '');

output.textContent = 'colgroup with hidden display value: ' + getComputedStyle(colgroup).display;