使用CSS将导航栏设置为停留在网页底部
要将导航栏设置在底部,请使用position:fixed属性,并具有bottom属性。
您可以尝试运行以下代码以实现位于底部的菜单,
示例
<!DOCTYPE html>
<html>
<head>
<style>
ul {
list-style-type: none;
position: fixed;
bottom: 0;
width: 100%;
}
li {
float: left;
border-right: 1px solid white;
}
li a {
display: block;
padding: 8px;
background-color: orange;
}
li:last-child {
border-right: none;
}
div {
padding:10px;
margin-top:10px;
background-color:white;
height:1000px;
}
</style>
</head>
<body>
<ul>
<li><a href = "#home">Home</a></li>
<li><a href = "#news">News</a></li>
<li><a href = "#contact">Contact</a></li>
<li><a href = "#about">About</a></li>
</ul>
<div>
<p>Adding demo text to check fixed menu.</p>
<p>Adding demo text to check fixed menu.</p>
<p>Adding demo text to check fixed menu.</p>
<p>Adding demo text to check fixed menu.</p>
<p>Adding demo text to check fixed menu.</p>
<p>Adding demo text to check fixed menu.</p>
<p>Adding demo text to check fixed menu.</p>
<p>Adding demo text to check fixed menu.</p>
<p>Adding demo text to check fixed menu.</p>
<p>Adding demo text to check fixed menu.</p>
<p>Adding demo text to check fixed menu.</p>
<p>Adding demo text to check fixed menu.</p>
<p>Adding demo text to check fixed menu.</p>
<p>Adding demo text to check fixed menu.</p>
</div>
</body>
</html>热门推荐
9 接春的祝福语简短
10 修祖屋祝福语简短
11 蛋糕祝福语送女友简短
12 药店祝福语简短10字
13 表达朋友的祝福语简短
14 公司上班祝福语大全简短
15 周末思念祝福语大全简短
16 给长辈祝福语简短大全
17 婶婶生日贺词简短祝福语
18 中秋祝福语送朋友简短