граница выходит за рамки родителя

Если задать flex элементам высоту 100% они выходят за границу своего родителя, как исправить

введите сюда описание изображения

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

body {
  background: #ddd;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wrapper {
  background: #ddd;
  width: 98%;
  height: 95%;
  border-radius: 20px;
  box-shadow: 0 0 10px rgba(0, 0, 0, .2);
  overflow: hidden;
}

.header {
  width: 100%;
  height: 80px;
  background: #fff;
  box-shadow: 0 0 10px rgba(0, 0, 0, .2);
}

.main {
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  width: 100%;
  height: 100%;
  padding: 20px;
  gap: 50px;
}

.menu {
  flex-basis: 20%;
  max-height: 100%;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(0, 0, 0, .2);
}

.content {
  flex-basis: 80%;
  max-height: 100%;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(0, 0, 0, .2);
}
<body>
  <div class="wrapper">
    <header class="header"></header>

    <div class="main">
      <div class="menu"></div>
      <div class="content">

      </div>
    </div>
  </div>
</body>


Ответы (1 шт):

Автор решения: Евгений Ли

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

body {
  background: #ddd;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wrapper {
  background: #ddd;
  width: 98%;
  height: 95%;
  border-radius: 20px;
  box-shadow: 0 0 10px rgba(0, 0, 0, .2);
  overflow: hidden;
  display: flex;
  row-gap: 20px;
  flex-direction: column;
  padding: 20px;
}

.header {
  width: 100%;
  height: 80px;
  background: #fff;
  box-shadow: 0 0 10px rgba(0, 0, 0, .2);
}

.main {
  display: flex;
  column-gap: 50px;
  width: 100%;
  height: 100%;
}

.menu {
  flex-basis: 20%;
  max-height: 100%;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(0, 0, 0, .2);
}

.content {
  flex-basis: 80%;
  max-height: 100%;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(0, 0, 0, .2);
}
<body>
  <div class="wrapper">
    <header class="header"></header>

    <div class="main">
      <div class="menu"></div>
      <div class="content">

      </div>
    </div>
  </div>
</body>

→ Ссылка