Created
March 14, 2018 18:48
-
-
Save Magneticdud/e63a4174ea9b84cb421702463213ea22 to your computer and use it in GitHub Desktop.
Responsive CSS tabs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1>Responsive CSS Tabs</h1> | |
<input id="tabmale" class="tabsinput" type="radio" name="tabs" checked> | |
<label for="tabmale">Man</label> | |
<input id="tabladyfit" class="tabsinput" name="tabs" type="radio" /> | |
<label for="tabladyfit">Lady</label> | |
<input id="tabkids" class="tabsinput" name="tabs" type="radio" /> | |
<label for="tabkids">Kid</label> | |
<section id="contentmale" class="mytabs"> | |
a | |
</section> | |
<section id="contentladyfit" class="mytabs"> | |
b | |
</section> | |
<section id="contentkids" class="mytabs"> | |
c | |
</section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* original by */ | |
@import url('https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css'); | |
/* tab taglie */ | |
#tabmale:checked ~ #contentmale, | |
#tabladyfit:checked ~ #contentladyfit, | |
#tabkids:checked ~ #contentkids { | |
display: block; | |
} | |
.tabsinput { | |
display: none; | |
} | |
.tabsinput:checked + label[for*="tab"] { | |
color: #555; | |
border: 1px solid #ddd; | |
border-top: 2px solid orange; | |
border-bottom: 1px solid #fff; | |
} | |
label[for*="tab"]:before { | |
font-family: fontawesome; | |
font-weight: normal; | |
margin-right: 10px; | |
} | |
label[for*="tab"] { | |
display: inline-block; | |
margin: 0 0 -1px; | |
padding: 15px 25px; | |
font-weight: 600; | |
text-align: center; | |
color: #bbb; | |
border: 1px solid transparent; | |
} | |
label[for*="tab"]:hover { | |
color: #888; | |
cursor: pointer; | |
} | |
label[for="tabmale"]:before { content: '\f183'; } | |
label[for="tabladyfit"]:before { content: '\f182'; } | |
label[for="tabkids"]:before { content: '\f1ae'; } | |
.mytabs { | |
display: none; | |
padding: 20px 0 0; | |
border-top: 1px solid #ddd; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment