I have 6 svg icons each contained in a div and also I have a general container that contains all of them with a width of 50%, three of these icons have a square aspect and the other three have a rectangle aspect.
As you can see in the code all the icons have a height of 80px but when the viewport shrinks the icons with rectangle aspect become smaller than their square siblings and that's not what I want, I want that all icons preserve the height (and the width), and if they are going to shrink then they all should preserve the height ratio i.e. they all should remain with the same height.
This is an issue that occurs only in chrome, in firefox it doesn't happen, though I didn't test it on other browsers.
Removing the 50% width from the container fixes this but I need to specify a width for reasons that are not relevant to the question.
.general-container{
background-color: peachpuff;
display: flex;
flex-direction: row;
width: 50%;
justify-content: space-between;
margin: 0 auto;
}
.icon-container{
display: block;
margin: 0 2px;
height: 80px;
}
<div class="general-container">
<div class="icon-container">
<svg width="100%" height="100%" viewBox="0 0 41 41" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
<g transform="matrix(1,0,0,1,-237.288,-229.987)">
<rect x="237.288" y="229.987" width="40.678" height="40.678"/>
</g>
</svg>
</div>
<div class="icon-container">
<svg width="100%" height="100%" viewBox="0 0 69 41" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
<g transform="matrix(1,0,0,1,-293.041,-229.987)">
<g transform="matrix(1.67742,0,0,1,-104.99,0)">
<rect x="237.288" y="229.987" width="40.678" height="40.678"/>
</g>
</g>
</svg>
</div>
<div class="icon-container">
<svg width="100%" height="100%" viewBox="0 0 41 41" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
<g transform="matrix(1,0,0,1,-237.288,-229.987)">
<rect x="237.288" y="229.987" width="40.678" height="40.678"/>
</g>
</svg>
</div>
<div class="icon-container">
<svg width="100%" height="100%" viewBox="0 0 69 41" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
<g transform="matrix(1,0,0,1,-293.041,-229.987)">
<g transform="matrix(1.67742,0,0,1,-104.99,0)">
<rect x="237.288" y="229.987" width="40.678" height="40.678"/>
</g>
</g>
</svg>
</div>
<div class="icon-container">
<svg width="100%" height="100%" viewBox="0 0 41 41" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
<g transform="matrix(1,0,0,1,-237.288,-229.987)">
<rect x="237.288" y="229.987" width="40.678" height="40.678"/>
</g>
</svg>
</div>
</div>