I posted this in the HTML forum but I thought I’d also post it here because it does have to do with CSS considerably.
So I’m trying to spice up my navigation on my website but I am having some difficulties with a:hover and the padding attribute. Basically I want my nav to have 10px of padding all the way around and when hovered over the background color to change, but when I hover over the nav link the extra padding kicks in and extends the width of nav link by the padding and moves my nav links to the right. I do not want this to happen. If you take a look at my beta site, you’ll be able to see this clearly. Any ideas on how to fix this??
[URL=”http://www.chrisdire.com/index_beta.htm”]http://www.chrisdire.com/index_beta.htm
[code=html]<ul id=”nav”>
<li class=”pagenav_current”><a title=”about me” href=”http://www.chrisdire.com/en/about.php”>about me</a></li>
<li class=”pagenav”><a title=”blog” href= “http://www.chrisdire.com/blog/”>blog</a></li>
<li class=”pagenav”><a title=”tech center” href=”http://www.chrisdire.com/en/techcenter.php”>tech center</a></li>
<li class=”pagenav”><a title=”gallery” href=”http://www.chrisdire.com/en/gallery.php”>gallery</a></li>
<li class=”pagenav”><a title=”contact” href=”http://www.chrisdire.com/en/contact.php”>contact</a></li>
</ul>
[CODE]#nav {
font-size: 13px;
font-weight: bold;
color: white;
text-decoration: none;
text-align: left;
width:435px;
height:28px;
margin-top: 21px;
margin-bottom: 19px;
padding-left: 35px;
float: left;
}
#nav li {
list-style-type: none;
float: left;
margin-right: 5px;
padding: 10px;
}
#nav li a {
display: inline;
text-decoration: none;
color: white;
font-weight: bold;
}
.pagenav {
background-color: #464646;
border: 1px solid black;
text-align: center;
}
.pagenav a:hover {
color: red;
margin: 0px;
background-color: #7D7D7D;
padding: 10px;
text-align: center;
}
.pagenav_current {
color: black;
background-color: red;
border: 1px solid black;
text-align: center;
}
.pagenav_current a:hover {
color: white;
padding: 10px;
background-color: #464646;
text-align: center;
}