tab-bar菜单凹陷效果

效果:

 

代码:

<!DOCTYPE html>
<html>

<head>
  <meta name="viewport" content="width=device-width, initial-scale=1">

  <style>
    body,
    html {
      margin: 0;
      padding: 0;
      height: 100%;
    }

    .box {
      position: fixed;
      width: 100%;
      height: auto;
      bottom: 0;
    }

    .itm_box {
      position: absolute;
      inset: 0;
      display: grid;
      stroke-width: 1px;
      stroke-linejoin: round;
      stroke-linecap: round;
      grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
    }

    .itm {
      fill: "00000000";
      stroke: green;
      text-align: center;
      line-height: calc(100vw / 5);
    }


    .vg {
      stroke-width: 0.5px;
    }

    .pp {
      fill: "00000000";
      stroke: green;
    }

    .pa_left_right {
      stroke-width: 1px;
    }

    .pa {
      stroke-width: 1px;
    }
  </style>
</head>

<body>
  <div class="box">
    <svg class="vg" viewBox="0 0 100 15" xmlns="http://www.w3.org/2000/svg">
      <path d="
        M0 0
        L40 0
        M40 -20
        A10 15 0 1 0 60 0
        L100 0
        L100 100
        L0 100
        L0 0
      " fill="gainsboro" stroke="green" />
      <path class="pa_left_right" d="M100 0 L100 100" stroke="gainsboro" />
      <path class="pa_left_right" d="M0 0 L0 100" stroke="gainsboro" />
      <path class="pa" d="M0 0 L40 0" stroke="green" />
      <path class="pa" d="M60 0 L100 0" stroke="green" />
    </svg>

    <div class="itm_box">
      <div class="itm">首页</div>
      <div class="itm">首页</div>
      <div class="itm">首页</div>
      <div class="itm">首页</div>
      <div class="itm">首页</div>
    </div>
  </div>
  
</body>

</html>

 

posted @ 2025-07-01 13:44  枫叶ak  阅读(10)  评论(0)    收藏  举报