Hi,
I want to place my horizontal navigation below the content in my xhtml and absolute position the navigation so it appears above the content when the page renders.
However I also want the navigation to be centered on the page. I've worked out how to do it but I think the code might be inefficient as it requires two div wrappers.
Has anyone got any suggestions to keep the code concise?
xhtml:
<body>
<div style="position: absolute; top: 350px; border: 1px solid #000000; width: 85%; height: 300px">
<div style="margin: 0 auto; border: 1px solid #000000; width: 630px; height: 50px">
<ul id="mainNav">
<li><a href="index.html">Home</a></li>
<li><a href="details.html">Details</a></li>
<li><a href="gallery.html">Gallery</a></li>
<li><a href="thingstodo.html">Things To Do</a></li>
<li><a href="finally.html">And Finally...</a></li>
</ul>
</div>
</div>
<span style="clear:both"><br /></span>
</body>
css:
body {
text-align: center;
}
ul#mainNav{
/* only for wireframe*/
border: 1px solid #000000;
float: left;
list-style: none;
margin: 0px;
padding: 0px;
}
ul#mainNav a{
display: block;
line-height: 2.1em;
padding: 0 2em;
text-decoration: none;
/* only for wireframe */
border: 1px solid #000000;
}
ul#mainNav li {
float: left;
}
ps inline styles are there just for the test case.
Thanks for your help!