Skip to content

Instantly share code, notes, and snippets.

@foca
Created July 10, 2012 05:12
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save foca/3081227 to your computer and use it in GitHub Desktop.
Save foca/3081227 to your computer and use it in GitHub Desktop.
Wizard navigation in CSS (using Twitter Bootstrap)
<ol class="wizard-nav">
<li class="done"><a href="#">Step 1</a></li>
<li class="done"><a href="#">Step 2</a></li>
<li class="active"><a href="#">Step 3</a></li>
<li><a href="#" data-disabled>Step 4</a></li>
<li><a href="#" data-disabled>Step 5</a></li>
</ol>
@mixin wizard-step($bgColor, $shadowTone) {
color: $white;
text-shadow: 0 1px 0 darken($bgColor, $shadowTone);
background: $bgColor;
&:before {
border-top-color: $bgColor;
border-bottom-color: $bgColor;
}
&:after {
border-left-color: $bgColor;
}
}
@mixin wizard-step-group($bgColor) {
a {
@include wizard-step($bgColor, 15%);
}
&:hover a {
@include wizard-step(darken($bgColor, 20%), 20%);
}
}
.wizard-nav {
position: relative;
list-style-type: none;
li {
position: relative;
float: left;
}
a {
position: relative;
display: inline-block;
height: 2 * $baseLineHeight;
line-height: 2 * $baseLineHeight;
margin-right: $baseLineHeight;
padding: 0px 10px;
color: lighten($grayDark, 45%);
background: #eee;
text-decoration: none;
font-weight: bold;
&:before, &:after {
width: 0;
height: 0;
position: absolute;
content: "";
top: 0;
border: $baseLineHeight solid #eee;
border-right-width: 0;
}
&:before {
border-left: $baseLineHeight / 2 solid transparent;
left: -$baseLineHeight / 2;
}
&:after {
border-color: transparent;
border-left: $baseLineHeight / 2 solid #eee;
right: -$baseLineHeight / 2;
}
}
.done { @include wizard-step-group($btnInfoBackground) }
.active { @include wizard-step-group($btnPrimaryBackground) }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment