简体   繁体   English

IE11中的max-width和flex不起作用

[英]max-width and flex in IE11 does not work

I am having an issue using flex box and max width in IE11. 我在IE11中使用弹性框和最大宽度时遇到问题。 I did search the web and I saw some solutions but NONE of them worked for me and that is why I posted a new thread. 我确实搜索过网络,但我看到了一些解决方案,但是没有一个解决方案适用于我,这就是我发布新帖子的原因。 Here is my code: 这是我的代码:

 .story-img { padding: 0px 0px 6px 0px; display: flex; justify-content: center; align-items: center; flex:1; } .story-img img { cursor: pointer; max-width: 100%; height: auto; flex-shrink: 0; } .row { width: 100px; } 
 <div class="row"> <div class="col-xs-12 story-img"> <div> <img class="img-responsive11" alt="" src="https://s3.amazonaws.com/resized.images.stg1.telegraphjournal.com/251861/desktop/comey-mob-analysis-56581436-3f0b-11e8-a7d1-e4efec6389f0.jpg"> </div> </div> </div> 

So as you see I am using max-width to control the image of a bigger size. 所以当你看到我使用max-width来控制更大尺寸的图像。 It works in all browsers except IE(I use IE11). 它适用于IE以外的所有浏览器(我使用的是IE11)。 Here is the codepen example of that: https://codepen.io/hminaee/pen/wXNjBK#code-area 这是codepen示例: https ://codepen.io/hminaee/pen/wXNjBK#code-area

Can you please help me? 你能帮我么?

In this case, I think the only thing you're missing is a width limit on the div parent of the image. 在这种情况下,我认为你唯一缺少的是图像div div的宽度限制。

Just add this to your code: 只需将其添加到您的代码中:

.story-img > div { width: 100% }

revised codepen 修改后的codepen

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM