简体   繁体   English

导航栏突然在顶部而不是底部HTML

[英]Navigation bar suddenly on top instead of bottom HTML

My navbar was fine and fixed at the bottom, until I added a link to the google font API and an additional font option in the html. 我的导航栏很好,固定在底部,直到我添加了指向Google字体API的链接和html中的其他字体选项。 I commented out everything I changed, then I deleted it, but nothing has worked. 我注释掉了所有更改,然后将其删除,但没有任何效果。 The navigation should be exactly as it is, just at the bottom. 导航应该完全正确,仅在底部。 Here is my 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>

Here is my CSS: 这是我的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;
}
.navbar{
    position:fixed;
    bottom:0;
    width:100%;
    height: desired height;
}

To stick your menu to the bottom of your viewport you need to set position fixed not relative.You don't need list-style:none; 要将菜单粘贴到视口的底部,您需要将位置设置为相对而不是固定。您不需要list-style:none; because you don't have any list on the nav tag. 因为您在nav标签上没有任何列表。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM