Created
November 15, 2012 00:38
-
-
Save minipai/4075863 to your computer and use it in GitHub Desktop.
A CodePen by Art Pai. CSS Chrome-like tab
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
<div class="tabs"> | |
<div class="tab"><div class="tab-box"></div></div> | |
<div class="tab"><div class="tab-box"></div></div> | |
<div class="tab active"><div class="tab-box"></div></div> | |
<div class="tab"><div class="tab-box"></div></div> | |
</div> | |
<div class="content"> | |
</div> |
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
$('.tab').click(function(){ | |
$('.tab').removeClass('active'); | |
$(this).addClass('active'); | |
}); |
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
body { | |
padding:100px; | |
} | |
.tabs { | |
height:45px; | |
padding: 0 0 0 0; | |
overflow:visible; | |
} | |
.tab { | |
width:200px; | |
height:45px; | |
overflow:hidden; | |
float:left; | |
margin:0 -15px 0 0; | |
} | |
.tab-box { | |
height:50px; | |
background: #fff; | |
border-radius: 4px; | |
border:1px solid #ccc; | |
margin:0 10px 0; | |
-webkit-transform: perspective(100px) rotateX(30deg); | |
} | |
.tab.active { | |
z-index:40; | |
position:relative; | |
padding-bottom:1px; | |
} | |
.tab.active .tab-box{ | |
background:#eee; | |
} | |
.content { | |
z-index:1; | |
padding:100px; | |
border:1px solid #ccc; | |
background:#eee; | |
position:relative: | |
} | |
.clear { | |
clear:both; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment