できるんだなァこれが…
HTMLはこれ
<div class="tab-content">
<input type="radio" id="tab1" name="tab" checked><label for="tab1">タブ1</label><input type="radio" id="tab2" name="tab"><label for="tab2">タブ2</label><input type="radio" id="tab3" name="tab"><label for="tab3">タブ3</label>
<div class="tab-box">
<div id="tabView1">コンテンツ1の内容が表示されます。コンテンツ1の内容が表示されます。</div>
<div id="tabView2">コンテンツ2の内容が表示されます。コンテンツ2の内容が表示されます。</div>
<div id="tabView3">コンテンツ3の内容が表示されます。コンテンツ3の内容が表示されます。</div>
</div>
</div>
CSSはこれ
.tab-content input[type="radio"] {
display: none;
}
.tab-content label {
display: inline-block;
padding: 5px 10px;
font-weight: bold;
font-size: 13px;
color: #009900;
background-color: #e1fae1;
cursor: pointer;
box-shadow: inset -1px 1px 2px rgba(0, 0, 0, 0.3);
border-radius: 5px 5px 0 0;
box-sizing: border-box;
}
.tab-content label:hover,
.tab-content input[type="radio"]:checked + label {
color: #FFF;
background-color: #009900;
}
.tab-content .tab-box {
width: 250px;
height: 100px;
padding: 10px;
border: 2px solid #009900;
border-radius: 0 5px 5px 5px;
box-sizing: border-box;
}
.tab-content > .tab-box > div {
display: none;
}
#tab1:checked ~ .tab-box > #tabView1 {
display: block;
}
#tab2:checked ~ .tab-box > #tabView2 {
display: block;
}
#tab3:checked ~ .tab-box > #tabView3 {
display: block;
}
素晴らしい
