2017-03-18 30 views
0

我目前正在为我的网站设计导航栏,我遇到了Firefox中的问题。我的标识位于左侧,导航内容位于右侧,但整个导航内容正在从导航div中移除(仅限于Firefox)。我能做些什么来解决它?火狐推送内容时,浮动权利

火狐: http://i.cubeupload.com/OoAJIe.png

铬: http://i.cubeupload.com/QXo2KS.png

这里是我的HTML:

<div class="nav" id="nav"> 
    <div class="nav_content"> 

     <ul> 
     <li class="logo"><a href="index.php"><img src="images/Spendr.png" /></a></li> 

     <li class="tab btn"><a href="panel/index.php"><button>Kurv: 0</button></a></li> 
     <li class="tab txt"><a href="#udbetaling">Nye varer</a></li> 
     <li class="tab txt"><a href="#features">Udsalg</a></li> 
     <li class="tab txt" id="kategorierMenu"><a>Kategorier</a></li> 
     </ul> 

    </div> 
    </div> 

这里是我的CSS:

.nav { 
    width: 100%; 
    background: #262626; 
    transition: background 0.5s, border 0.5s, color 0.5s, height 0.5s, padding-top 0.3s, opacity 0.5s; 
    position: fixed /*fixed*/; 
    z-index: 999; 
    height: 71px; 
    float: left; 
} 

.nav_content { 
    max-width: 1150px; 
    width: 90%; 
    height: 100%; 
    background: none; 
    margin: 0 auto; 
    white-space: nowrap; 
} 

.nav ul li, .nav ul li a { 
    list-style: none; 
    text-decoration: none; 
    display: inline-block; 
} .nav .tab{ 
    float: right; 
    font-family: DroidSans, sans-serif; 
    font-size: 16px; 
    color: #FFFFFF; 
    text-decoration: none; 
    transition: color 0.3s; 
} 

.txt a { 
    float: right; 
    font-family: DroidSans, sans-serif; 
    font-size: 16px; 
    color: #FFFFFF; 
    text-decoration: none; 
    transition: color 0.3s; 
    height: 100%; 
    padding-top: 26px; 
    box-sizing: border-box; 
    transition: background 0.3s; 
} 

.txt a:hover { 
    cursor: pointer; 
    background: #1A1A1A; 
} 
.nav .tab { border-radius: 3px; } 
.nav .txt a { 
    padding-left:18px; 
    padding-right: 18px; 
} 

.logo img { 
    height: 36px; 
    width: auto; 
    margin-top: 18px; 
    float: left; 
} 
+0

尝试改变'.logo IMG {边距}''到填充-top' –

回答

0

既然你浮动.tab元素的权利,添加.logo { float: left; },这将使列表项都浮动在菜单的任一侧。

.nav { 
 
    width: 100%; 
 
    background: #262626; 
 
    transition: background 0.5s, border 0.5s, color 0.5s, height 0.5s, padding-top 0.3s, opacity 0.5s; 
 
    position: fixed/*fixed*/ 
 
    ; 
 
    z-index: 999; 
 
    height: 71px; 
 
    float: left; 
 
} 
 

 
.nav_content { 
 
    max-width: 1150px; 
 
    width: 90%; 
 
    height: 100%; 
 
    background: none; 
 
    margin: 0 auto; 
 
    white-space: nowrap; 
 
} 
 

 
.nav ul li, 
 
.nav ul li a { 
 
    list-style: none; 
 
    text-decoration: none; 
 
    display: inline-block; 
 
} 
 

 
.nav .tab { 
 
    float: right; 
 
    font-family: DroidSans, sans-serif; 
 
    font-size: 16px; 
 
    color: #FFFFFF; 
 
    text-decoration: none; 
 
    transition: color 0.3s; 
 
} 
 

 
.txt a { 
 
    float: right; 
 
    font-family: DroidSans, sans-serif; 
 
    font-size: 16px; 
 
    color: #FFFFFF; 
 
    text-decoration: none; 
 
    transition: color 0.3s; 
 
    height: 100%; 
 
    padding-top: 26px; 
 
    box-sizing: border-box; 
 
    transition: background 0.3s; 
 
} 
 

 
.txt a:hover { 
 
    cursor: pointer; 
 
    background: #1A1A1A; 
 
} 
 

 
.nav .tab { 
 
    border-radius: 3px; 
 
} 
 

 
.nav .txt a { 
 
    padding-left: 18px; 
 
    padding-right: 18px; 
 
} 
 

 
.logo img { 
 
    height: 36px; 
 
    width: auto; 
 
    margin-top: 18px; 
 
    float: left; 
 
} 
 

 
.logo { 
 
    float: left; 
 
}
<div class="nav" id="nav"> 
 
    <div class="nav_content"> 
 

 
    <ul> 
 
     <li class="logo"> 
 
     <a href="index.php"><img src="images/Spendr.png" /></a> 
 
     </li> 
 

 
     <li class="tab btn"><a href="panel/index.php"><button>Kurv: 0</button></a></li> 
 
     <li class="tab txt"><a href="#udbetaling">Nye varer</a></li> 
 
     <li class="tab txt"><a href="#features">Udsalg</a></li> 
 
     <li class="tab txt" id="kategorierMenu"><a>Kategorier</a></li> 
 
    </ul> 
 

 
    </div> 
 
</div>

您还可以更改菜单为flex布局和使用auto缘上.logo的元素分开。

.nav { 
 
    width: 100%; 
 
    background: #262626; 
 
    transition: background 0.5s, border 0.5s, color 0.5s, height 0.5s, padding-top 0.3s, opacity 0.5s; 
 
    position: fixed/*fixed*/ 
 
    ; 
 
    z-index: 999; 
 
    height: 71px; 
 
    float: left; 
 
} 
 

 
.nav_content { 
 
    max-width: 1150px; 
 
    width: 90%; 
 
    height: 100%; 
 
    background: none; 
 
    margin: 0 auto; 
 
    white-space: nowrap; 
 
} 
 

 
.nav ul li, 
 
.nav ul li a { 
 
    list-style: none; 
 
    text-decoration: none; 
 
    display: inline-block; 
 
} 
 

 
.nav .tab { 
 
    float: right; 
 
    font-family: DroidSans, sans-serif; 
 
    font-size: 16px; 
 
    color: #FFFFFF; 
 
    text-decoration: none; 
 
    transition: color 0.3s; 
 
} 
 

 
.txt a { 
 
    float: right; 
 
    font-family: DroidSans, sans-serif; 
 
    font-size: 16px; 
 
    color: #FFFFFF; 
 
    text-decoration: none; 
 
    transition: color 0.3s; 
 
    height: 100%; 
 
    padding-top: 26px; 
 
    box-sizing: border-box; 
 
    transition: background 0.3s; 
 
} 
 

 
.txt a:hover { 
 
    cursor: pointer; 
 
    background: #1A1A1A; 
 
} 
 

 
.nav .tab { 
 
    border-radius: 3px; 
 
} 
 

 
.nav .txt a { 
 
    padding-left: 18px; 
 
    padding-right: 18px; 
 
} 
 

 
.logo img { 
 
    height: 36px; 
 
    width: auto; 
 
    margin-top: 18px; 
 
    float: left; 
 
} 
 

 
.nav ul { 
 
    display: flex; 
 
} 
 

 
.logo { 
 
    margin-right: auto; 
 
}
<div class="nav" id="nav"> 
 
    <div class="nav_content"> 
 

 
    <ul> 
 
     <li class="logo"> 
 
     <a href="index.php"><img src="images/Spendr.png" /></a> 
 
     </li> 
 

 
     <li class="tab btn"><a href="panel/index.php"><button>Kurv: 0</button></a></li> 
 
     <li class="tab txt"><a href="#udbetaling">Nye varer</a></li> 
 
     <li class="tab txt"><a href="#features">Udsalg</a></li> 
 
     <li class="tab txt" id="kategorierMenu"><a>Kategorier</a></li> 
 
    </ul> 
 

 
    </div> 
 
</div>