-
-
Save csssecrets/1345dc9399dc8e794502 to your computer and use it in GitHub Desktop.
Trapezoid 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
/** | |
* Trapezoid tabs | |
*/ | |
body { | |
padding: 40px; | |
font: 130%/2 Frutiger LT Std, sans-serif; | |
} | |
nav { | |
position: relative; | |
z-index: 1; | |
padding-left: 1em; | |
} | |
nav > a { | |
position: relative; | |
display: inline-block; | |
padding: .3em 1em 0; | |
color: inherit; | |
text-decoration: none; | |
margin: 0 -.3em; | |
} | |
nav > a::before, | |
main { | |
border: .1em solid rgba(0,0,0,.4); | |
} | |
nav a::before { | |
content: ''; /* To generate the box */ | |
position: absolute; | |
top: 0; right: 0; bottom: 0; left: 0; | |
z-index: -1; | |
border-bottom: none; | |
border-radius: .5em .5em 0 0; | |
background: #ccc linear-gradient(hsla(0,0%,100%,.6), hsla(0,0%,100%,0)); | |
box-shadow: 0 .15em white inset; | |
transform: scale(1.1, 1.3) perspective(.5em) rotateX(5deg); | |
transform-origin: bottom; | |
} | |
nav a.selected { z-index: 2;} | |
nav a.selected::before { | |
background-color: #eee; | |
margin-bottom: -.08em; | |
} | |
main { | |
display: block; | |
margin-bottom: 1em; | |
background: #eee; | |
padding: 1em; | |
border-radius: .15em; | |
} | |
nav.left > a::before { | |
transform: scale(1.2, 1.3) perspective(.5em) rotateX(5deg); | |
transform-origin: bottom left; | |
} | |
nav.right { padding-left: 2em; } | |
nav.right > a::before { | |
transform: scale(1.2, 1.3) perspective(.5em) rotateX(5deg); | |
transform-origin: bottom right; | |
} |
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
<!-- This HTML is invalid and just for demo purposes. Don't use multiple main elements! --> | |
<nav> | |
<a href="#">Home</a> | |
<a href="#" class="selected">Projects</a> | |
<a href="#">About</a> | |
</nav> | |
<main> | |
Content area | |
</main> | |
<nav class="left"> | |
<a href="#">Home</a> | |
<a href="#" class="selected">Projects</a> | |
<a href="#">About</a> | |
</nav> | |
<main> | |
Content area | |
</main> | |
<nav class="right"> | |
<a href="#">Home</a> | |
<a href="#" class="selected">Projects</a> | |
<a href="#">About</a> | |
</nav> | |
<main> | |
Content area | |
</main> |
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
// alert('Hello world!'); |
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
{"view":"split","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