Image stretching in flexbox in Safari

前端 未结 5 2035
别那么骄傲
别那么骄傲 2020-12-14 00:31

This is only an issue in Safari and looks like a Safari bug to me. Here is a fiddle with a simplified version of the issue.

When an image is in a nested flexbox elem

5条回答
  •  北海茫月
    2020-12-14 01:09

    See my demo for a working example, add flex-direction: column; to fix this issue.

    .container {
      display: flex;
      flex-direction: column;
    }
    
    .container section:first-child {
      display: flex;
      flex-direction: column;
      margin-bottom: 25px;
    }
    
    .container img {
      width: 125px;
      height: auto;
    }

提交回复
热议问题