Skip to content Skip to sidebar Skip to footer

How To Shrink Flex Items Height To Fit Container Heights

I am trying to display a layout below in flex . I have divs of equal width and height. I want to achieve the layout out below. By placing one item on the left and the remaining f

Solution 1:

Try this

body,
html {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
.container {
  display: flex;
  min-height: 100vh;
  background: #2A3052;
}
.left {
  flex: 1;
  background: #9497A8;
  margin: 10px;
}
.right {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.box {
  flex: 1;
  background: #9497A8;
  margin: 10px;
}
<div class="container">
  <div class="left"></div>
  <div class="right">
    <div class="box"></div>
    <div class="box"></div>
    <div class="box"></div>
    <div class="box"></div>
  </div>
</div>

Post a Comment for "How To Shrink Flex Items Height To Fit Container Heights"