Tabs (no JS)
Tabs can be built with no JavaScript, using hidden radio inputs as state and labels as clickable headings.
Code
<div class="tabs">
<input type="radio" name="tab" id="tab1" checked style="display:none">
<input type="radio" name="tab" id="tab2" style="display:none">
<div style="display:flex;gap:0.5rem;margin-bottom:0.5rem">
<label for="tab1" style="padding:0.5rem 1rem;background:#21262d;border-radius:6px;cursor:pointer">Overview</label>
<label for="tab2" style="padding:0.5rem 1rem;background:#21262d;border-radius:6px;cursor:pointer">Details</label>
</div>
<div class="panel1" style="padding:1rem;background:#161b22;border-radius:8px">First tab's content</div>
<div class="panel2" style="padding:1rem;background:#161b22;border-radius:8px;display:none">Second tab's content</div>
</div>
<style>
#tab2:checked ~ .panel1 { display: none; }
#tab2:checked ~ .panel2 { display: block; }
</style>
Preview
Explanation
Radio inputs sharing the same name allow only one to be active at once. The :checked ~ CSS selector controls the matching panel's visibility via general sibling combinators.
- A fully accessible version with ARIA tab/tabpanel roles usually still needs a bit of JS to manage aria-selected.