Flexbox中心和右下角的项目

yeo*_*uuu 8 html5 css3 flexbox

我正在尝试使用flexbox实现以下结果: Flexbox演示

我尝试使用以下html但我无法让它工作.

<div class=" flex-center">
    <div class="flex-item-center">
        <p>
            Some text in box A
        </p>
    </div>
    <div class="flex-item-bottom">
        <p>Some text in box B....</p>
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

CSS:

.flex-center {
  display: flex;
  align-items: center;
  align-content: center;
  justify-content: center;
}
.flex-item-center {
  align-self: center;
}

.flex-item-bottom {
  align-self: flex-end;
}
Run Code Online (Sandbox Code Playgroud)

我怎样才能让它看起来像图像?

Dan*_*dez 8

我已经提出了一个可行的解决方案。

.flex-center {
  background-color: #739FD0;
  color: #000000;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  align-content: center;
  align-items: center;
  height: 400px;
}
.flex-center-bottom {
  background-color: #739FD0;
  color: #000000;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-content: center;
  align-items: center;
}
.flex-item-center {
  border: solid 2px #4675AA;
  order: 0;
  flex: 0 1 auto;
  align-self: center;
}
.flex-item-bottom {
  border: solid 2px #4675AA;
  order: 1;
  flex: 0 1 auto;
  align-self: flex-end;
}
Run Code Online (Sandbox Code Playgroud)
<div class="flex-center">
  <div class="flex-item-center">
    <p>DROP FILES HERE</p>
  </div>
</div>
<div class="flex-center-bottom">
  <div class="flex-item-center">
    <p>Hint: You can also drop files in the all files page</p>
  </div>
</div>
Run Code Online (Sandbox Code Playgroud)

2017 年更新:在 Google Chrome 版本 62.0.3202.89(官方版本)(32 位)中测试。

.flex-center,
.flex-center-bottom {
  align-items: center;
  background-color: #739FD0;
  color: #000000;
  display: flex;
}

.flex-center {
  height: 400px;
  justify-content: center;
}

.flex-center-bottom {
  justify-content: flex-end;
}

.flex-item-center {
  border: solid 2px #4675AA;
  font-family: Arial, sans-serif;
  font-size: 1.6em;
  line-height: 1px;
  padding: 0 3px;
}
Run Code Online (Sandbox Code Playgroud)
<div class="flex-center">
  <div class="flex-item-center">
    <p>Some text in box A</p>
  </div>
</div>
<div class="flex-center-bottom">
  <div class="flex-item-center">
    <p>Some text in box B...</p>
  </div>
</div>
Run Code Online (Sandbox Code Playgroud)

我希望这可以帮助你。