How is the height of .footer
calculated in scenario #2?
#1
.footer {
}
img {
width: 100%;
}
<div class="footer">
<img src="https://media.istockphoto.com/photos/whole-kiwi-fruit-and-half-kiwi-fruit-on-white-picture-id834807852?k=6&m=834807852&s=612x612&w=0&h=qyouQR9CrIlrPo8FG72PCt1eBV_lTVtnuwVlo9hWZY8=" class="linked-image">
</div>
The calculation for the footer's height in this case involves considering the width of the initial-containing block (html
) and accounting for the aspect ratio of the image.
#2
.footer {
font-size: 15px;
line-height: 1.2em;
width: 100vw;
background-color: #090B19;
color: white;
}
.footer .icons {
display: -ms-grid;
display: grid;
-ms-grid-columns: (1fr)[3];
grid-template-columns: repeat(3, 1fr);
-ms-grid-rows: 100%;
grid-template-rows: 100%;
margin: 0 auto;
}
img {
height: 100%;
width: 100%;
}
<div class="footer">
<div class="icons">
<a href="www.google.com" target="_blank"><img src="https://www.applesfromny.com/wp-content/uploads/2020/05/Jonagold_NYAS-Apples2.png" class="github-img"></a>
<a href="https://stackoverflow.com/users/14037283/tonitone120?tab=summary" target="_blank"><img src="https://www.applesfromny.com/wp-content/uploads/2020/05/Jonagold_NYAS-Apples2.png" class="so-image"></a>
<a href="www.google.com" target="_blank"><img src="https://media.istockphoto.com/photos/whole-kiwi-fruit-and-half-kiwi-fruit-on-white-picture-id834807852?k=6&m=834807852&s=612x612&w=0&h=qyouQR9CrIlrPo8FG72PCt1eBV_lTVtnuwVlo9hWZY8=" class="linked-image"></a>
</div>
</div>
I'm trying to determine what sets the height of the footer since each image's width is a third of the footer's width. Could the intrinsic dimensions of the images be influencing it despite not scaling up to their aspect ratio? The height
of img
is specified as 100%, but 100% of what?