2017-04-25 92 views
0

我的導航欄很好並固定在底部,直到我在html中添加了谷歌字體API和其他字體選項的鏈接。我評論了我改變的一切,然後我刪除了它,但沒有任何工作。導航應該完全保持原樣,就在底部。 這裏是我的html:導航欄突然在頂部而不是底部HTML

<div class="navbar"> 
<nav> 
    <a href="otherpage.html">Blog</a> 
    <a href="otherpage.html">Linguistics Facts</a> 
    <a href="otherpage.html">More About Me</a> 
</nav> 
</div> 


</body> 
</html> 

這裏是我的CSS:

.navbar { 
    position: relative; 
    bottom: 0; 
    width: 100%; 
    list-style: none; 
} 

.navbar a { 
    float: center; 
    display: block; 
    text-align: center; 
    padding: 10px 12px; 
    margin: 15px; /*experimental*/ 
    background-color: #f7b733; 
    color: white; 
    font-family: 'PassionTea', 'Amatic SC'; 
    font-size: 170%; 
    list-style-type: none; 
} 
+0

您面臨什麼問題?你能發表問題的圖片嗎? – Nimish

+0

nav應該在什麼底部? 'float:center'無效btw –

+0

是的,我超越了自己,試圖使用我並不完全瞭解的財產。它應該在頁面的底部,但我擺脫了浮動屬性,並將位置改爲絕對,並且這解決了問題。老實說,我不知道我以前是如何做到的。謝謝! –

回答

0
.navbar{ 
    position:fixed; 
    bottom:0; 
    width:100%; 
    height: desired height; 
} 

要堅持你的菜單,視口的你需要設置固定不relative.You不要」位置的底部需要列表式:無;因爲你在導航標籤上沒有任何列表。