Reputation: 691
I tried to center all my nav items and have them horizontally aligned
However when I added my .logo
class to the navbar, all my navigation items move down.. how do i fix this?
Here is the JSFiddle: http://jsfiddle.net/nq397fby/
Upvotes: 0
Views: 103
Reputation: 1205
http://jsfiddle.net/AlexCharlton/nq397fby/6/
ul.navigation li {
vertical-align: top;
display: table-cell;
height: 40px;
width: 20%;
line-height: 40px;
text-align: center;
white-space: nowrap;
}
.logo {
position:relative;
top: -30px;
left: 6px;
}
Upvotes: 1
Reputation: 8189
Just use vertical-align: top
ul.navigation li {
display: table-cell;
height: 40px;
width: 20%;
line-height: 40px;
text-align: center;
white-space: nowrap;
vertical-align: top;
}
Edit : logo alignment
ul.navigation li.logo {
margin: 0;
padding: 0;
position: relative;
top: -37px;
}
Upvotes: 0
Reputation: 71150
You can simply add position:absolute
to your class:
ul.navigation li.logo {
margin: 0;
padding: 0;
position:absolute;
}
That said, you may actually wish to position the child link element to create better alignment:
ul.navigation li.logo {
margin: 0;
padding: 0;
position:relative;
}
ul.navigation li.logo a {
position:absolute;
left:20px;
top:-42px;
}
Upvotes: 0