Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

full height using flex-direction: column

I want my c1 to be fully stretched, but I wonder why when I apply flex:1 it doesn’t fill up the space.

.wrap {
  display:flex;
  flex-direction: column;
}

.c1 {
  background: red;
  flex: 1;
}

.c2 {
  background: blue;
}
<div class='wrap'>
  <div class='c1'>
    <div>child 1</div>
    <div>more content</div>
   </div>
  <div class='c2'>child 2</div>
</div>

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

In your wrap class you have to add the height.

.wrap {
  display:flex;
  flex-direction: column;
  height: 100vh;
}

.c1 {
  background: red;
  flex: 1;  
}

.c2 {
  background: blue;
}
<div class='wrap'>
  <div class='c1'>
    <div>child 1</div>
    <div>more content</div>
   </div>
  <div class='c2'>child 2</div>
</div>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading