【发布时间】:2017-03-17 00:45:15
【问题描述】:
我有以下代码将我的内容垂直居中
html
<div class="titleHide flex">
<h4>...</h4>
<h1>...</h1>
</div>
css
.titleHide {
position: absolute;
top: 0; left: 0;
height: 100%; width: 100%;
background-color: rgba(209,30,93,0.8);
}
.flex {
display: flex;
flex: 1;
align-items: center;
}
.flex 被我网站上的其他 div 使用。但是在这种情况下,它会将 h1 和 h4 标题并排排列,我希望它们堆叠在一起。
【问题讨论】: