【问题标题】:Flexbox and vertical align not working in IE EdgeFlexbox 和垂直对齐在 IE Edge 中不起作用
【发布时间】:2016-12-08 23:19:05
【问题描述】:

我正在尝试在 Bootstrap 3.3.7 using flexbox 的一行内垂直对齐列。该行的最小高度必须为62px

我有 列;一列 (.title) 总是包含一些文本,另外两列有时可能是 hidden or empty。无论如何,它们应该始终在行中垂直对齐。

我有这个 html

.titlebar {
  border: 1px solid red;
  font-size: 21px;
  line-height: 1.2em;
  min-height: 62px;
  overflow: hidden;
  margin-left: 0;
  margin-right: 0;
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -webkit-flex-direction: column;
  -ms-flex-direction: column;
  flex-direction: column;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  -ms-flex-pack: center;
  justify-content: center;
}
.titlebar .title {
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  -ms-flex-pack: center;
  justify-content: center;
  -webkit-box-align: center;
  -webkit-align-items: center;
  -ms-flex-align: center;
  align-items: center;
  font-size: 21px;
}
.titlebar .byline {
  font-size: 16px;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
  <div class="row titlebar">
    <div class="col-sm-8 col-md-9 col-sm-offset-4 col-md-offset-3 title">Title</div>
    <div class="col-sm-8 col-md-9 col-sm-offset-4 col-md-offset-3 byline"></div>
    <div class="col-sm-12 visible-xs-block titlebar-gradient"></div>
  </div>
</div>

它在 Chrome 和 Firefox 中有效,但在 IE Edge 中无效。 See Bootply here。我错过了什么?

【问题讨论】:

    标签: html css twitter-bootstrap flexbox


    【解决方案1】:

    好的,IE 10-11 似乎不适用于 min-height:https://philipwalton.com/articles/normalizing-cross-browser-flexbox-bugs/

    将 min-height 更改为 height 即可解决问题。

    【讨论】:

    • Edge 中仍在发生同样的事情。你用这条评论为我的工作节省了很多时间和头痛。
    猜你喜欢
    • 2018-06-26
    • 2017-12-18
    • 1970-01-01
    • 2018-04-21
    • 1970-01-01
    • 2015-03-01
    • 2015-10-16
    • 2016-07-01
    相关资源
    最近更新 更多