JSFiddle - React, Tailwind, and code Playground
by vaheed akhtar
HTML
<div class="tabs">
<div class="tab">
<input type="radio" id="tab-1" name="tab-group-1" checked>
<label for="tab-1">Tab One</label>
<div class="content">
stuff
</div>
</div>
<div class="tab">
<input type="radio" id="tab-2" name="tab-group-1">
<label for="tab-2">Tab Two</label>
<div class="content">
stuff222222222
</div>
</div>
<div class="tab">
<input type="radio" id="tab-3" name="tab-group-1">
<label for="tab-3">Tab Three</label>
<div class="content">
stuff3333333333
</div>
</div>
</div>
CSS
.tabs {
position: relative;
min-height: 200px; /* This part sucks */
clear: both;
}
.tab {
float: left;
margin: 0px 10px;
}
.tab label {
padding: 10px;
margin-left: -1px;
position: relative;
left: 1px;
cursor:pointer;
}
.tab [type=radio] {
display: none;
}
.content {
position: absolute;
top: 28px;
left: 0;
background: white;
right: 0;
bottom: 0;
padding: 20px;
}
[type=radio]:checked ~ label {
background: white;
border-bottom: 1px solid #f57f22;
z-index: 2;
}
[type=radio]:checked ~ label ~ .content {
z-index: 1;
}