Skip to content

Instantly share code, notes, and snippets.

@alicelara
Created February 11, 2014 18:29
Show Gist options
  • Save alicelara/8940976 to your computer and use it in GitHub Desktop.
Save alicelara/8940976 to your computer and use it in GitHub Desktop.
Testing Tabs
/**Testing Tabs
* The first commented line is your dabblet’s title
*/
html {
background: aliceblue;
background: linear-gradient(45deg, #609040, #a0d080);
min-height: 100%;
}
body {
margin: 80px 0 0 0;
color: #FFF;
font: 18px/1.2em Georgia;
}
a {
color: #FFF;
text-decoration: none;
}
.tabs {
position: relative;
display: block;
background-color: #FFF;
width: 30em;
margin: 0 auto;
}
.group-tabs {
position: absolute;
top:0;
left:0;
}
.group-tabs h2 {
position: relative;
top: -1.1em;
text-align: center;
line-height: 2em;
width: 6em;
z-index:2;
}
.group-tabs h2 a{
width:100%;
display: block;
border-radius: 15px 15px 0 0;
}
.group-tabs:last-child h2 {
left: 12.23em;
}
.group-tabs:nth-child(2) h2 {
left: 6.1em;
}
.group-tabs div p {
height:0;
width:0;
overflow:hidden;
visibility: hidden;
}
.group-tabs:first-child p {
position: relative;
top: -2.8em;
width: 27.4em;
box-sizing: border-box;
padding: 1.5em;
border-radius: 0 0 15px 15px ;
background-color: #ddd;
overflow: visible;
visibility: visible;
height: auto;
}
.group-tabs:target ~ .group-tabs:first-child p{
height:0;
width:0;
overflow:hidden;
visibility: hidden;
}
.group-tabs:target a {
background-color: #DDD
}
.group-tabs:target p {
position: relative;
top: -2.8em;
width: 27.4em;
box-sizing: border-box;
padding: 1.5em;
border-radius: 0 0 15px 15px ;
background-color: #ddd;
overflow: visible;
visibility: visible;
height: auto;
}
.group-tabs:not(:target) h2 a{
background-color:#cecece;
}
<!-- content to be placed inside <body>…</body> -->
<article class="tabs">
<section id="tab1" class="group-tabs">
<h2>
<a href="#tab1">Tab1</a>
</h2>
<div>
<p>tab1 content</p>
</div>
</section>
<section id="tab2" class="group-tabs">
<h2>
<a href="#tab2">Tab2</a>
</h2>
<div>
<p>tab2 content</p>
</div>
</section>
<section id="tab3" class="group-tabs">
<h2>
<a href="#tab3">Tab3</a>
</h2>
<div>
<p>tab3 content</p>
</div>
</section>
</article>
// alert('Hello world!');
{"view":"split-vertical","fontsize":"100","seethrough":"","prefixfree":"1","page":"css"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment