Fancy CSS navigation
Rough CSS reproduction of the navigation found at http://beta.rallyinteractive.com/
by Jens Grochtdreis
HTML
<nav class="nav">
<h1>Fancy CSS navigation<h1>
<a class="nav-item nav-prev" href="#non">
<span class="icon"><</span>
<span class="text">About</span>
</a>
<a class="nav-item nav-next" href="#non">
<span class="text">Contact</span>
<span class="icon">></span>
</a>
</nav>
CSS
body {
margin: 0;
background: #fff;
}
.nav {
position: relative;
width: 800px;
padding: 0 60px;
margin: 20px auto;
text-align: center;
font-family: arial, sans-serif;
}
.nav h1 {
font-size: 36px;
font-weight: bold;
line-height: 60px;
}
/* =============================================================================
Nav items
========================================================================== */
.nav-item {
position: absolute;
top: 0;
width: 60px;
text-decoration: none;
}
.nav-prev {
left: 0;
padding-left: 70px;
}
.nav-next {
right: 0;
padding-right: 70px;
}
/* =============================================================================
Nav text
========================================================================== */
.nav-item .text {
position: absolute;
z-index: 1;
font-size: 24px;
font-weight: bold;
line-height: 60px;
color: transparent;
-webkit-transition: all 0.3s ease-in-out;
-moz-transition: all 0.3s ease-in-out;
-o-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
}
.nav-item:hover .text,
.nav-item:focus .text,
.nav-item:active .text {
color: #222;
-webkit-transition-delay: 0.2s;
-moz-transition-delay: 0.2s;
-o-transition-delay: 0.2s;
transition-delay: 0.2s;
}
/*
* Previous
*/
.nav-prev .text {
left: 0;
}
.nav-prev:hover .text,
.nav-prev:focus .text,
.nav-prev:active .text {
left: 70px;
}
/*
* Next
*/
.nav-next .text {
right: 0;
}
.nav-next:hover .text,
.nav-next:focus .text,
.nav-next:active .text {
right: 70px;
}
/* =============================================================================
Nav icons
========================================================================== */
.nav-item .icon {
position: absolute;
z-index: 2;
top: 0;
display: block;
overflow: hidden;
text-indent: -999em;
...
JavaScript
/*
A rough CSS reproduction of the navigation found at http://beta.rallyinteractive.com/
*/