<!DOCTYPE html>
<html>
  <head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <style>
      body {
        margin: 0;
        padding-bottom: 60px; /* 底部菜单栏的高度 */
      }
<pre><code>  .menu {
    position: fixed;
    bottom: 0;
    width: 100%;
    height: 60px; /* 底部菜单栏的高度 */
    background-color: #f2f2f2;
  }
  
  .menu ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 100%;
  }
  
  .menu li {
    flex: 1;
    text-align: center;
  }
  
  .menu a {
    text-decoration: none;
    color: #333;
    font-size: 16px;
    display: block;
    padding: 10px;
  }
  
  .menu a:hover {
    background-color: #ddd;
  }
&lt;/style&gt;
</code></pre>
  </head>
  <body>
    <div class="menu">
      <ul>
        <li><a href="#">菜单1</a></li>
        <li><a href="#">菜单2</a></li>
        <li><a href="#">菜单3</a></li>
        <li><a href="#">菜单4</a></li>
      </ul>
    </div>
  </body>
</html>
HTML5 手机端底部固定菜单栏代码示例

原文地址: https://www.cveoy.top/t/topic/ptuR 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录