我的导航栏错误地定位在FF中

时间:2011-06-23 21:26:52

标签: html css html-helper navbar

在IE中,导航栏已正确定位,以顶部为中心。然而在FF中,它一直向右移动。我查看了代码,仍然无法弄明白。有任何想法吗?提前谢谢!

#wrapper
{
display: block;
border: 0px solid red;
width: 896px; /*background:white;*/
margin: 0em auto;
padding: 0em;
display: block;
text-align: left;
height: auto;
}
#wrapperInner
{
display: block;
border: 0px solid red;
width: 896px; /*background:white;*/
margin: 0em auto;
padding: 0em;
display: block;
height: auto;
}

/*Menu----------------------------------------------------*/

/*------Tabs---------*/

#tabNav
{
width: 895px;
border: 0px solid red;
}

#tabNav table
{
width: 895px;
border: 0px solid red;
}
#tabNav td
{
border: 0px solid blue;
padding: 0px;
vertical-align: middle;
}
#tabNav img
{
padding: 0px;
vertical-align: bottom;
}

<div id="tabNav">
<table border="0" cellspacing="0" cellpadding="0">
    <tr>
        <td id="MainNavigation1_tab0" align="center" valign="bottom" class="tabPos1-OffHome">
            &nbsp;</td>

        <td id="MainNavigation1_tab1" align="center" valign="top" class="tabOffHome" style="vertical-align: top;">
            <a href="ourMenu.aspx" class="navLink">
                <img id="MainNavigation1_imgOurMenu" onMouseOver="this.src='images/tabMenuOvr.gif';" onMouseOut="this.src='images/tabMenuOff.gif';" src="images/tabMenuOff.gif" style="border-width:0px;" /></a></td>

        <td id="MainNavigation1_tab1Over" valign="bottom" class="tabOverlapOffHome">
            &nbsp;</td>

        <td id="MainNavigation1_tab2" align="center" class="tabOffHome" style="vertical-align: top;">
            <a class="navLink" href="account.aspx">
                <img id="MainNavigation1_imgExpress" onMouseOver="this.src='images/tabExpressOvr.gif';" onMouseOut="this.src='images/tabExpressOff.gif';" src="images/tabExpressOff.gif" style="border-width:0px;" /></a></td>

        <td id="MainNavigation1_tab2Over" valign="bottom" class="tabOverlapOffHome2">
            &nbsp;</td>

        <td id="MainNavigation1_tab3" align="center" class="tabOff" style="vertical-align: top;">
            <a class="navLink" href="customerCenter.aspx">
                <img id="MainNavigation1_imgCustomer" onMouseOver="this.src='images/tabCustCareOvr.gif';" onMouseOut="this.src='images/tabCustCareOff.gif';" src="images/tabCustCareOff.gif" style="border-width:0px;" /></a></td>

        <td id="MainNavigation1_tab3Over" valign="bottom" class="tabOverlapOff">
            &nbsp;</td>

        <td id="MainNavigation1_tab4" align="center" class="tabOff" style="vertical-align: top;">
            <a class="navLink" href="ordering.aspx">

                <img id="MainNavigation1_img101" onMouseOver="this.src='images/tabOrder101Ovr.gif';" onMouseOut="this.src='images/tabOrder101Off.gif';" src="images/tabOrder101Off.gif" style="border-width:0px;" /></a></td>

        <td id="MainNavigation1_tab4Over" valign="bottom" class="tabOverlapOff">
            &nbsp;</td>

        <td id="MainNavigation1_tab5" align="center" class="tabOff" style="vertical-align: top;">
            <a class="navLink" href="skinnyUs.aspx">
                <img id="MainNavigation1_imgSkinny" onMouseOver="this.src='images/tabSkinnyOvr.gif';" onMouseOut="this.src='images/tabSkinnyOff.gif';" src="images/tabSkinnyOff.gif" style="border-width:0px;" /></a></td>

        <td id="MainNavigation1_tab5Over" valign="bottom" class="tabOverlapOff">

            &nbsp;</td>

        <td id="MainNavigation1_tab6" align="center" class="tabOff" style="vertical-align: top;">
            <a class="navLink" href="joinUs.aspx">
                <img id="MainNavigation1_imgJoin" onMouseOver="this.src='images/tabJoinUsOvr.gif';" onMouseOut="this.src='images/tabJoinUsOff.gif';" src="images/tabJoinUsOff.gif" style="border-width:0px;" /></a></td>

        <td id="MainNavigation1_tab6Over" valign="bottom" class="tabOverlapOff">
            &nbsp;</td>

        <td id="MainNavigation1_tab7" align="center" class="tabOff" style="padding-left: 7px; vertical-align: top;">

            <a class="navLink" href="faqs.aspx">
                <img id="MainNavigation1_imgFAQs" onMouseOver="this.src='images/tabFaqsOvr.gif';" onMouseOut="this.src='images/tabFaqsOff.gif';" src="images/tabFaqsOff.gif" style="border-width:0px;" /></a></td>

        <td id="MainNavigation1_tab7Over" align="center" class="tabPos7-Off">
            &nbsp;</td>

    </tr>
    <tr id="MainNavigation1_trLowerNav">
<td id="MainNavigation1_tdLowerNav" class="bgMenuHome-Off" colspan="15">
            <!--inner tab nav-->

            <div id="MainNavigation1_subNavHome" class="subNav">
                <br />
            </div>

3 个答案:

答案 0 :(得分:1)

float:left添加到#tabNav table。在Firefox 5中看起来很完美。

答案 1 :(得分:0)

您是否在文档顶部声明了doctype?如果没有,你需要一个......

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

另外,你为什么要使用桌子?

答案 2 :(得分:0)

我插入了你的代码并找到了答案。您所要做的就是将以下内容添加到#tabnav id

保证金:0自动;