In the following fiddle I am trying to get the .content divs to fill the height of the parent (.side-child), by using 100% width and height of the parent. The .side-child divs have the correct height, the only problem is getting the .content imgs to fill their parent (whilst maintaining aspect ration).
https://jsfiddle.net/d6L2bve9/5/
<div id="side">
<div class="side-child">
<img src="https://www.icann.org/assets/icann_logo-52672386035a35504af59606040687c8.png" class="content" />
</div>
<div class="side-child">
<img src="https://www.icann.org/assets/icann_logo-52672386035a35504af59606040687c8.png" class="content" />
</div>
<div class="side-child">
<img src="https://www.icann.org/assets/icann_logo-52672386035a35504af59606040687c8.png" class="content" />
</div>
</div>
CSS
#side {
height : 100vh;
display : flex;
flex-direction : column;
width : 50px;
}
.content {
height : 100%;
background : #ff0000;
}
.side-child {
flex-grow : 1;
}
I can get it to work by setting the .side-child position to relative and .content to absolute below
https://jsfiddle.net/5sgfcjy4/2/
But I do not understand why I have to do this since .side-child already has the correct height? Im guessing its because technically the .side-child divs do not have a height value therefore 100% cannot be used?