CSS 底部菜单栏通常是指网页布局中固定在页面底部的一组导航链接或按钮。这种设计可以方便用户在浏览网页时随时访问主要功能或页面。
以下是一个简单的固定底部菜单栏的示例代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>底部菜单栏示例</title>
<style>
body {
margin: 0;
font-family: Arial, sans-serif;
}
.footer {
position: fixed;
bottom: 0;
width: 100%;
background-color: #333;
color: white;
text-align: center;
padding: 10px 0;
}
.footer a {
color: white;
text-decoration: none;
margin: 0 15px;
}
.footer a:hover {
color: #ddd;
}
</style>
</head>
<body>
<div class="content">
<!-- 页面内容 -->
<h1>欢迎来到我的网站</h1>
<p>这是一个底部菜单栏的示例。</p>
</div>
<div class="footer">
<a href="#home">首页</a>
<a href="#services">服务</a>
<a href="#about">关于我们</a>
<a href="#contact">联系我们</a>
</div>
</body>
</html>
padding-bottom
,使其高度等于底部菜单栏的高度。.content {
padding-bottom: 50px; /* 底部菜单栏的高度 */
}
@media (max-width: 600px) {
.footer a {
display: block;
margin: 5px 0;
}
}
希望这些信息对你有所帮助!
领取专属 10元无门槛券
手把手带您无忧上云