I'm facing some challenges with the following design requirements:
- Need to add 8px padding on top and bottom of the navigation bar.
- Title should be aligned to the left.
- Links need to be right-aligned.
- Navigation bar background should be 100% wide but only 1080px in width (centered).
- Dropdown menu should have a horizontal border separating each link.
- Padding for the dropdown menu should be 4px at the top and bottom, with an additional 4px indent.
For reference, here is the link to my code on jsfiddle: http://jsfiddle.net/6L8jJ/
Here's the HTML snippet:
<header>
<div class="nav_top_bar">
<nav class="nav_top_menu">
<ul>
<li class="nav_top_title"><b>title</b></li>
<li><a href="" class="blue">option</a>
<ul>
<li><a href="" class="blue">suboption</a></li>
</ul>
</li>
<li><a href="" class="green">option</a>
<ul>
<li><a href="" class="green">suboption 1</a></li>
<li><a href="" class="green">suboption 2</a></li>
</ul>
</li>
<li><a href="" class="orange">option</a>
<ul>
<li><a href="">suboption 1</a></li>
<li><a href="">suboption 2</a></li>
</ul>
</li>
<li><a href="" class="purple">option</a></li>
<li><a href="" class="yellow">option</a></li>
</ul>
</nav>
</div>
</header>
And here's the CSS style applied:
.nav_top_bar {
background-color: #333333;
padding: 8px 0;
width: 100%;
clear: both;
}
.nav_top_menu {
color: #c3c3c3;
font-size: 1em;
margin: 0 auto;
text-align: left;
width: 1080px;
}
.nav_top_title {
padding-right: 50px;
}
.nav_top_menu ul {
list-style: none;
text-align: left;
margin: 0;
padding: 0;
}
.nav_top_menu ul li {
display: inline;
float: left;
position: relative;
}
.nav_top_menu ul li a {
color: #c3c3c3;
display: block;
margin-left: 1px;
/* padding: 8px 16px; */
padding: 8px 20px 8px 0px;
white-space: nowrap;
}
.nav_top_menu ul li a:hover {
color: #ffffff;
}
.nav_top_menu li ul {
background-color: #333;
display: none;
}
.nav_top_menu li:hover ul {
border-top: 1px #ccc solid;
border-left: 1px #ccc solid;
border-right: 1px #ccc solid;
display: block;
position: absolute;
}
.nav_top_menu li:hover li {
border-bottom: 1px #ccc solid;
float: none;
font-size: 0.8em;
font-weight: bold;
padding-left: 4px;
text-align: left;
}