对齐 flexbox 中的内容在 IE 11 中不起作用

Justify-content in flexbox not working in IE 11

我想让一个元素右对齐。我使用了 flexbox,因为我发现它最容易完美地对齐文本和任何图标。下面的代码片段是我正在做的事情的一个例子。该代码在 Firefox 和 Chrome 中完美运行,但 justify-content 在 IE 中不起作用。我已经有了“-ms-flex-pack”,但它什么也没做。内容在 IE 中左对齐,而不是右对齐。

.align-right {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex; 
    -webkit-box-align: center; 
        -ms-flex-align: center; 
            align-items: center; 
    -webkit-box-pack: right; 
        -ms-flex-pack: right; 
            justify-content: right;
    text-align:right;
}

.bold {
     font-weight: 600;
}
<div class = "align-right">
                  Purchase Date: &nbsp;
                  <span class = "bold"> 09/10/2018</span>
                </div>

您需要将 flex-direction: column; 添加到父元素,以便在 IE11 中对齐内容

.align-right {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex; 
  -webkit-box-align: center; 
    -ms-flex-align: center; 
        align-items: center; 
  -webkit-box-pack: right; 
    -ms-flex-pack: right; 
        justify-content: right;
  text-align:right;
  flex-direction: column; }

以下内容适用于不同的浏览器。

.text-vcenter-right {
    height: 200px;
    width: 100%;
    background-color: grey;
    color: white;

    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: end;
    -ms-flex-pack: end;
    justify-content: right;
    text-align:right;
}
<div class="text-vcenter-right">Text vertically centered and justified towards right</div>