Auto Resize Image in CSS FlexBox Layout and keeping Aspect Ratio?

后端 未结 8 854
长情又很酷
长情又很酷 2020-12-12 12:34

I\'ve used the CSS flex box layout which appears as shown below:

\"enter

If t

8条回答
  •  臣服心动
    2020-12-12 13:13

    I came here looking for an answer to my distorted images. Not totally sure about what the op is looking for above, but I found that adding in align-items: center would solve it for me. Reading the docs, it makes sense to override this if you are flexing images directly, since align-items: stretch is the default. Another solution is to wrap your images with a div first.

    .myFlexedImage {
      display: flex;
      flex-flow: row nowrap;
      align-items: center;
    }
    

提交回复
热议问题