-
-
Save drsii/6134386 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<a class="tab tab-one tab-active" href="#" tabindex="0">1</a> | |
<a class="tab tab-two" href="#" tabindex="0">2</a> | |
<a class="tab tab-three" href="#" tabindex="0">3</a> | |
<section data-tab="one" data-tab-active=""><h2>One</h2> micro tabs are hot</section> | |
<section data-tab="two"><h2>Two</h2> they work really well</section> | |
<section data-tab="three"><h2>Three</h2>accept the annoying default browser scroll to.</section> |
This file contains hidden or 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
/* Hide all tab sections.*/ | |
[data-tab] { | |
display:none; | |
} | |
/* Lets show the first section*/ | |
[data-tab-active] { | |
display:block; | |
} | |
/* Set focus for each tab, because we declare tabindex the state holds */ | |
.tab:focus { | |
outline:none; | |
} | |
/* The only draw back is we must declare each tab. hey we do that anyways in js solutions*/ | |
.tab-one:focus ~ [data-tab=one], | |
.tab-two:focus ~ [data-tab=two], | |
.tab-three:focus ~ [data-tab=three]{ | |
display:block; | |
} | |
/* Hide all sections not in focus */ | |
.tab:not(.tab-one):focus ~ [data-tab-active]{ | |
display:none; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment