Instantly share code, notes, and snippets.
Last active
March 5, 2017 22:30
-
Star
(10)
10
You must be signed in to star a gist -
Fork
(4)
4
You must be signed in to fork a gist
-
Save bjcull/9498339 to your computer and use it in GitHub Desktop.
Wizard style navigation tabs for bootstrap
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
.nav-pills.nav-wizard > li { | |
position: relative; | |
overflow: visible; | |
border-right: 15px solid transparent; | |
border-left: 15px solid transparent; | |
} | |
.nav-pills.nav-wizard > li + li { | |
margin-left: 0; | |
} | |
.nav-pills.nav-wizard > li:first-child { | |
border-left: 0; | |
} | |
.nav-pills.nav-wizard > li:first-child a { | |
border-radius: 5px 0 0 5px; | |
} | |
.nav-pills.nav-wizard > li:last-child { | |
border-right: 0; | |
} | |
.nav-pills.nav-wizard > li:last-child a { | |
border-radius: 0 5px 5px 0; | |
} | |
.nav-pills.nav-wizard > li a { | |
border-radius: 0; | |
background-color: #eee; | |
} | |
.nav-pills.nav-wizard > li:not(:last-child) a:after { | |
position: absolute; | |
content: ""; | |
top: 0px; | |
right: -20px; | |
width: 0px; | |
height: 0px; | |
border-style: solid; | |
border-width: 20px 0 20px 20px; | |
border-color: transparent transparent transparent #eee; | |
z-index: 150; | |
} | |
.nav-pills.nav-wizard > li:not(:first-child) a:before { | |
position: absolute; | |
content: ""; | |
top: 0px; | |
left: -20px; | |
width: 0px; | |
height: 0px; | |
border-style: solid; | |
border-width: 20px 0 20px 20px; | |
border-color: #eee #eee #eee transparent; | |
z-index: 150; | |
} | |
.nav-pills.nav-wizard > li:hover:not(:last-child) a:after { | |
border-color: transparent transparent transparent #aaa; | |
} | |
.nav-pills.nav-wizard > li:hover:not(:first-child) a:before { | |
border-color: #aaa #aaa #aaa transparent; | |
} | |
.nav-pills.nav-wizard > li:hover a { | |
background-color: #aaa; | |
color: #fff; | |
} | |
.nav-pills.nav-wizard > li.active:not(:last-child) a:after { | |
border-color: transparent transparent transparent #428bca; | |
} | |
.nav-pills.nav-wizard > li.active:not(:first-child) a:before { | |
border-color: #428bca #428bca #428bca transparent; | |
} | |
.nav-pills.nav-wizard > li.active a { | |
background-color: #428bca; | |
} |
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
.nav-pills { | |
&.nav-wizard { | |
> li { | |
position: relative; | |
overflow: visible; | |
border-right: 15px solid transparent; | |
border-left: 15px solid transparent; | |
+ li { | |
margin-left: 0; | |
} | |
&:first-child { | |
border-left: 0; | |
a { | |
border-radius:5px 0 0 5px; | |
} | |
} | |
&:last-child { | |
border-right: 0; | |
a { | |
border-radius:0 5px 5px 0; | |
} | |
} | |
a { | |
border-radius: 0; | |
background-color: #eee; | |
} | |
&:not(:last-child) a:after { | |
position: absolute; | |
content: ""; | |
top: 0px; | |
right: -20px; | |
width: 0px; | |
height: 0px; | |
border-style: solid; | |
border-width: 20px 0 20px 20px; | |
border-color: transparent transparent transparent #eee; | |
z-index: 150; | |
} | |
&:not(:first-child) a:before { | |
position: absolute; | |
content: ""; | |
top: 0px; | |
left: -20px; | |
width: 0px; | |
height: 0px; | |
border-style: solid; | |
border-width: 20px 0 20px 20px; | |
border-color: #eee #eee #eee transparent; | |
z-index: 150; | |
} | |
&:hover { | |
&:not(:last-child) a:after { | |
border-color: transparent transparent transparent #aaa; | |
} | |
&:not(:first-child) a:before { | |
border-color: #aaa #aaa #aaa transparent; | |
} | |
a { | |
background-color: #aaa; | |
color: #fff; | |
} | |
} | |
&.active { | |
&:not(:last-child) a:after { | |
border-color: transparent transparent transparent #428bca; | |
} | |
&:not(:first-child) a:before { | |
border-color: #428bca #428bca #428bca transparent; | |
} | |
a { | |
background-color: #428bca; | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just an FYI, this is more or less broken when using Bootstrap 4 - the nav pill structure has been slightly updated. Here's a BS4-compatible CSS version: https://gist.github.com/tiesont/5b291c8344944f22c3d67cb902464048