Responsive Pure CSS Tabs
Source: http://webdesignerhut.com/create-pure-css-tabs/
by Petr Haluza
HTML
<div class="tabs">
<input type="radio" name="tabs" id="tab1" checked >
<label for="tab1">
<i class="fa fa-html5"></i><span>HTML5</span>
</label>
<input type="radio" name="tabs" id="tab2">
<label for="tab2">
<i class="fa fa-css3"></i><span>CSS3</span>
</label>
<input type="radio" name="tabs" id="tab3">
<label for="tab3">
<i class="fa fa-code"></i><span>jQuery</span>
</label>
<div id="tab-content1" class="tab-content">
<p>#1 Tab content here</p>
</div> <!-- #tab-content1 -->
<div id="tab-content2" class="tab-content">
<p>#2 Tab content here<br>Lorem Ipsum</p>
</div> <!-- #tab-content2 -->
<div id="tab-content3" class="tab-content">
<p>#3 Tab content here</p>
</div> <!-- #tab-content3 -->
</div>
CSS
/*.tabs {
max-width: 90%;
float: none;
list-style: none;
padding: 0;
margin: 75px auto;
border-bottom: 4px solid #ccc;
}*/
.tabs:after {
content: '';
display: table;
clear: both;
}
.tabs input[type=radio] {
display:none;
}
.tabs label {
display: block;
float: left;
width: 33.3333%;
text-decoration: none;
text-align: center;
line-height: 2;
cursor: pointer;
}
.tabs label:hover {
color: #3498db;
}
.tab-content {
display: none;
width: 100%;
float: left;
padding: 15px;
box-sizing: border-box;
background-color:#ffffff;
}
.tabs [id^="tab"]:checked + label {
background: #FFF;
box-shadow: inset 0 4px #3498db;
border-bottom: 4px solid #3498db;
color: #3498db;
}
#tab1:checked ~ #tab-content1,
#tab2:checked ~ #tab-content2,
#tab3:checked ~ #tab-content3 {
display: block;
}
@media (min-width: 768px) {
.tabs i {
padding: 5px;
margin-right: 10px;
}
.tabs label span {
display: inline-block;
}
.tabs {
max-width: 750px;
margin: 50px auto;
}
}