我在 IE11 上遇到 flexbox 问题,虽然我知道有很多已知问题,但我一直无法找到解决方案…
<div class="latest-posts">
<article class="post-grid">
<img src="http://lorempixel.com/image_output/cats-q-c-640-480-4.jpg" alt="" />
<div class="article-content">
<h2>THIS IS POST TITLE</h2>
<p>BLAH</p>
</div>
</article>
</div>
还有 CSS…
img {
max-width: 100%;
}
.latest-posts {
margin: 30px auto;
}
article.post-grid {
width: 375px;
float: left;
margin: 0 25px 100px 0;
padding-bottom: 20px;
background-color: #fff;
border: 1px solid #f3f3f3;
border-radius: 2px;
font-size: 14px;
line-height: 26px;
display: flex;
flex: 1 0 auto;
flex-direction: column;
justify-content: flex-start;
align-content: flex-start;
}
.article-content {
padding: 20px 35px;
}
图像在 flex 容器中被拉伸。
应用 align-items: flex-start
(我想,因为“拉伸”是默认值……)或 justify-content: flex-start
似乎不起作用。
Codepen: 我的意思的例子
我究竟做错了什么?
原文由 Jusi 发布,翻译遵循 CC BY-SA 4.0 许可协议
为避免这种有趣的行为,您可以重置
flex-shrink
属性。这看起来像一个错误,尽管微软说:
http://codepen.io/anon/pen/KzBOvq