I am using the css flex to layout a series of 3 lines of logos. They are all the same size apart from two in the last line which are a bit deeper.
All the logos in the last line are being stretched to be the same depth, ie that of the deeper pair.

Image shows that the logos 1,3 and 5 have been stretched vertically
How do I stop this please.
    .brandLogos div{
      display:flex;
      display:-webkit-flex;	
      flex-flow: wrap;
      -webkit-flex-flow: wrap;
      -webkit-justify-content: space-between;
      justify-content: space-between; 	
    }
    
    .brandLogos img {
      border:1px solid green;
      margin-right:10px;
      margin-bottom:30px;
    }
    
    <div class="brandLogos">
     <div>
     .. 10 previous images 
      <img src="/uploads/2017/03/santander.jpg" alt="santander logo" width="134" height="70" />
      <img src="/uploads/2017/03/Sony.jpg" alt="" width="134" height="119" />
      <img src="/uploads/2017/03/talktalk.jpg" alt="talktalk logo" width="134" height="70" /> 
      <img src="/uploads/2017/03/unilever.jpg" alt="unilever logo" width="134" height="119" />
      <img src="/uploads/2017/03/Warburtonslogo.jpg" alt="warburtons logo" width="134" height="70" />
     </div>
    </div>
By default, everything has flex-basis:auto , which in this case means that each flex item starts out its flexing at its image's intrinsic width. So your huge-image flex items have a huge flex basis, and your small-image flex items have a small flex basis.
A flexbox item can be set to a fixed width by setting 3 CSS properties — flex-basis, flex-grow & flex-shrink. flex-basis : This property specifies the initial length of the flex item. flex-grow : This property specifies how much the flex item will grow relative to the rest of the flex items.
You can easily shrink an image by using the flex-wrap property in CSS and it specifies whether flex items are forced into a single line or wrapped onto multiple lines.
You need to set the align-items: center;, which by default is stretch
Example
.brandLogos div{
  display:flex;
  display:-webkit-flex; 
  flex-flow: wrap;
  -webkit-flex-flow: wrap;
  -webkit-justify-content: space-between;
  justify-content: space-between;
  align-items: center;
  -webkit-align-items: center;
}
More info: https://css-tricks.com/snippets/css/a-guide-to-flexbox/
Use align-items on the container.
Possible values are:
flex-startflex-endcenterbaselinestretch is the default.
FYI: http://devdocs.io/css/align-items
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With