【日常记录】【CSS】css实现汉堡菜单-布局

时间:2024-03-26 10:52:31

在这里插入图片描述

  <style>
    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }

    body {
      display: flex;
      justify-content: center;
      align-items: center;
      height: 100vh;
    }

    .hamburger {
      display: flex;
      flex-direction: column;
      justify-content: space-between;

      cursor: pointer;
      width: 40px;
      height: 40px;
      /* border: 1px solid red; */
    }

    .hamburger_line {
      height: 4px;
      background: rgb(203 213 225);
      transition: all .2s;
    }
  </style>
  <div class="hamburger">
    <div class="hamburger_line"></div>
    <div class="hamburger_line"></div>
    <div class="hamburger_line"></div>
  </div>