I have a little problem aligning my horizontal navigation bar to the center of the browser. Now, before I put forward this request, I want to indicate that I am new to HTML and CSS, so bear with me, which is undoubtedly a quick fix!
Headers and footers should be full width with fixed content in the center of the browser. The navigation bar should be under the heading. Currently, the bar is aligned to the left, but it does not seem to budge without losing its shape.
HTML:
<body>
<div id="header">
<div class="wrap">
<img src="images/logo_header.png" alt="Image alt." />
</div>
</div>
<div id="nav">
<div class="wrap">
<ul>
<li><a href="#">Option 1</a></li>
<li><a href="#">Option 2</a></li>
<li><a href="#">Option 3</a></li>
<li><a href="#">Option 4</a></li>
<li><a href="#">Option 5</a></li>
<li><a href="#">Option 6</a></li>
</ul>
</div>
</div>
<div id="content"><div class="wrap">Content</div></div>
<div id="footer"><div class="wrap">Footer</div></div>
</body>
and CSS:
body {
margin:0;
padding:0;
font-family:verdana;
}
.wrap {
position:relative;
margin:0 auto;
width:960px;
}
#header {
float:left;
width:100%;
background-color:#FFCC33;
}
#nav {
float:left;
background-color:#FFCC33;
border-top:2px solid #000000;
}
#nav ul {
list-style:none;
display:inline;
margin:0px;
padding:0px;
}
#nav li {
display:inline;
line-height:1.8em;
}
source
share