I am trying to build a navigation bar like the Github's one (without using the Bootstrap nav*
selectors - please see this jsfiddle
So I have the following HTML:
<div class="container" style="margin-top: 20px;">
<div class="span9">
<ul class="unstyled main-tabs">
<li>
<a href="#">Link1</a>
</li>
<li>
<a href="#">Link2</a>
</li>
<li>
<a href="#">Link3</a>
</li>
</ul>
</div>
</div>
Note the span9
class that I am using to force the navigation bar to occupy only 9/12 of my screen.
And the following CSS:
.main-tabs {
position: relative;
margin-bottom: 20px;
font-size: 12px;
font-weight: bold;
background-color: #eaeaea;
background-image: -moz-linear-gradient(#fafafa, #eaeaea);
background-image: -webkit-linear-gradient(#fafafa, #eaeaea);
background-image: linear-gradient(#fafafa, #eaeaea);
background-repeat: repeat-x;
border: 1px solid #eaeaea;
border-bottom-color: #cacaca;
border-radius: 3px;
}
.main-tabs a {
display: block;
text-align: center;
line-height: 35px;
font-size: 12px;
color: #777;
text-decoration: none;
text-shadow: 0 1px 0 white;
border-right: 1px solid #eee;
border-right-color: rgba(0,0,0,0.04);
border-left: 1px solid #fcfcfc;
border-left-color: rgba(255,255,255,0.7);
border-bottom: 2px solid #DADADA;
}
.main-tabs li {
list-style-type: none;
}
.main-tabs li .active {
border-bottom: 2px solid greenyellow;
}
The result is:
I changed .main-tabs li
to:
.main-tabs li {
list-style-type: none;
float: left;
}
Then
.main-tabs li {
list-style-type: none;
display: block;
}
This still gives the same results :(
But this did not really help.
QUESTION
Without hardcoding the width of li
or ul
elements (for responsiveness matters), is there a way to get the same navigation bar like the one on Github?