我正在尝试在具有最小高度的弹性盒容器中垂直对齐一些文本,除了ie11之外,它都很好用,因为内容没有居中。
.banner {
background:#ccc;
padding: 10px 20px;
display: flex;
align-items: center;
justify-content: center;
min-height: 60px;
flex-direction:column;
}
<div id="section-title-1" class="banner banner--theme-1 js-section-title" data-title="Section Title">
<span>IE is bobbins</span>
</div>
我已经查看了一些类似问题的解决方案,有人建议添加高度来解决问题,但这显然会使min-height
失效,因此并不是很有用。
有没有人知道如何在IE中使用min-height
实现垂直居中?
flex-direction: row
让它工作,但是你需要为你的内容项添加flex-grow
。修订版演示 - Michael Benjamin