Hey all,
I have a horizontal navigation bar on a web page, based on the CSS Anthology’s example of the horizontal menu. The HTML and CSS for my attempt at this particular example are listed below:
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.DTD">
<html xmlns="http:www.w3.org/1999/xhtml">
<head>
<title>HikeDirect</title>
<meta http-equiv="Content-Type"
content="text/html; charset=utf-8"/>
<link href="nav bar test.css" rel="stylesheet" type="text/css"/>
</head!>
<div id="body">
<div id="header">
<div id="site name">
<h1>Hike Direct</h1>
</div>
<div id="tagline">
<p>Comprehensive hiking and outdoor info and advice</p>
</div><!-- end of div tagline --!>
</div><!-- end of div header --!>
<div id="navigation">
<ul>
<li><a href="hdindex.html">Home</a></li>
<li><a href="hdarticles.html">Articles</a></li>
<li><a href="whereto.html">Where to?</a></li>
<li><a href="hdblog.html">Blog</a></li>
<li><a href="directory.html">Product and merchant directory</a></li>
<li><a href="reviews.html">Reviews</a></li>
</ul>
</div><!-- end of div navigation --!>
</html>
CSS:
#navigation {
position: absolute;
top: 127px; left: 0;
padding: 1em;
text-decoration: none;
border: 1px dotted navy;
font-size: 90%;
color: navy;
font-weight: bold;
width: 100%;
background-color: #ffcc33;
}
#navigation ul {
list style: none;
padding: 0;
margin: 0;
padding top: 1em;
}
#navigation li {
display: inline;
border: 1px solid black;
padding: 1em;
margin: 0px;
left: 0;
right: 0;
}
#navigation a:link, #navigation a:visited; {
padding: 0em, 1em, 0em, 1em;
color:#FFFFFF;
background-color: #B51032;
text-decoration: none;
border: 1px solid #711515;
padding: 1em;
}
#navigation a:hover {
color: #FFFFFF;
background: #711515;
padding: 1em;
margin: 0;
}
My three main problems that I can’t seem to fix, seen in this screenshot, are:
1/ That I can’t remove the yellow spaces between the side borders of the link and dark red background of the hover state.
2/ The 2 or 3 pixel spaces between the side borders of the links and left side of the home link.
3/ Getting the links to sit flush side by side, be all the same width and to span across the width of the page.
So in other words, I want to get rid of the padding (yellow spaces) at the sides of the links in hover state, and I want the links to sit flush side by side, with no gap, be equal in width and span across the whole screen.
I’ve read some tutorials on how to get the links centre aligned and evenly distributed, but from what I understand, that would mean changing the approach from inline display to a float display and I would like to avoid this as I am not familiar with the float display. Or if float display is the only way to do this, I would appreciate suggestions on how to do it and a sample or where I can find one.
Cheers.