Forum Moderators: not2easy

Message Too Old, No Replies

Simple nav. works in IE, not in FF

         

kslnor

1:38 pm on Nov 9, 2007 (gmt 0)

10+ Year Member



I have a simple navigation that works fine in IE, but does not work in Firefox. The links do not work at all - the hover aspect as well as the actual link. Can someone please take a look at my code (I won't post everything, just the CSS and the HTML for the navigation). I did discover - through process of elimination - that this particular piece of CSS is the culprit (I think): left:50%; but I need it to place the nav. links where I want them.

FYI, the doctype is: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

CSS

/* navigation */

#navcontainer {
left:50%;
margin:0 0 0 -59px;
position:absolute;
width:104px;
}

#navcontainer ul
{
margin-left: 0;
padding-left: 0;
list-style-type: none;
font-family: Arial, Helvetica, sans-serif;
text-align:center;
}

#navcontainer a
{
display: block;
padding: 8px;
width: 105px;
background-color: #400000;

}

#navcontainer a:link, #navlist a:visited
{
color: #D8C6A6;
text-decoration: none;
}

#navcontainer a:hover
{
background-color: #D8C6A6;
color: #400000;
}

HTML

<div id="navcontainer">
<ul id="navlist">
<li><a href="http://www.example.com">Home</a></li>
<li><a href="http://www.example.com/contactus.html">
ContactUs</a></li>
<li><a href="http://www.example.com/aboutus.html">Who Are We?</a></li>
<li><a href="http://www.example.com/services.html">Services / Prices</a></li>
<li><a href="http://www.example.com/portfolio.html">
Portfolio</a></li>
</ul>
</div>

Thank you!

[edited by: jatar_k at 3:18 pm (utc) on Nov. 9, 2007]
[edit reason] please use example.com [/edit]

Marshall

6:50 am on Nov 10, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



kslnor,

Without taking a hard look, I bet I can guess what the problem is as others have suffered it before. You probably have a <div> overlapping your links. Put a border around each <div> and see where they fall.

Marshall

kslnor

5:01 pm on Nov 10, 2007 (gmt 0)

10+ Year Member



Nope...no <div>'s overlapping. Any other suggestions?

Thanks.

encyclo

8:56 pm on Nov 10, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Your example code above works as expected in Firefox 2.0.

Why is the width of the #navcontainer set at 104px? Place a 1px red border on that element, you will see it doesn't cover the width of the menu. Your #navcontainer a is 105px plus 8px each side (total 121px), so try setting #navcontainer as 121px with a negative margin of 61px. (Without seeing more code, it's not easy to diagnose.)

SuzyUK

11:22 am on Nov 11, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



>suggestions
have you tried setting a z-index on the #navcontainer?

it's quite possible there are overlapping divs as Marshall suggested but on the z-axis rather than visually

also just fyi if you also float the

#navcontainer a
elements you can remove the whitespace between the links in IE7 (at least I'm seeing whitespace in this test code sample :o)