html底部导航栏代码

html
<!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; padding: 0; font-family: Arial, sans-serif; } /* 底部导航栏的样式 */ .footer { position: fixed; bottom: 0; width: 100%; background-color: #333; color: #fff; text-align: center; padding: 10px 0; } /* 底部导航栏链接的样式 */ .footer a { color: #fff; text-decoration: none; margin: 0 10px; } </style> </head> <body> <!-- 底部导航栏 --> <div class="footer"> <a href="#">首页</a> <a href="#">产品</a> <a href="#">关于我们</a> <a href="#">联系我们</a> </div> </body> </html>

这段代码创建了一个固定在页面底部的导航栏,其中包含了四个链接:首页、产品、关于我们和联系我们。你可以根据需要自行修改链接文字和样式。

如果你想进一步改进底部导航栏,你可以考虑添加一些动态效果、图标或者更复杂的布局。

html
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>底部导航栏</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css"> <style> body { margin: 0; padding: 0; font-family: Arial, sans-serif; } .footer { position: fixed; bottom: 0; width: 100%; background-color: #333; color: #fff; text-align: center; padding: 10px 0; display: flex; justify-content: center; align-items: center; } .footer a { color: #fff; text-decoration: none; margin: 0 20px; transition: all 0.3s ease; } .footer a:hover { color: #ffd700; } .footer i { margin-right: 5px; } </style> </head> <body> <div class="footer"> <a href="#"><i class="fas fa-home"></i>首页</a> <a href="#"><i class="fas fa-box"></i>产品</a> <a href="#"><i class="fas fa-info-circle"></i>关于我们</a> <a href="#"><i class="fas fa-phone"></i>联系我们</a> </div> </body> </html>

在这个示例中,我使用了Font Awesome图标库来添加图标到导航栏的链接中。通过使用CSS过渡效果,当鼠标悬停在链接上时,链接的颜色会发生变化,提供了一种交互式的体验。你可以根据需要调整图标、颜色和其他样式来适应你的项目需求。