Css 尝试使用Flexbox垂直居中
我正在创建一个简单的页脚,并希望其中的所有文本垂直居中。我尝试了几种方法,但都不奏效:Css 尝试使用Flexbox垂直居中,css,flexbox,Css,Flexbox,我正在创建一个简单的页脚,并希望其中的所有文本垂直居中。我尝试了几种方法,但都不奏效: footer { height: 50px; width: 100%; bottom: 0; position: fixed; background-color: lightgray; flex: display; flex-direction: column; justify-content: center; justify-items
footer {
height: 50px;
width: 100%;
bottom: 0;
position: fixed;
background-color: lightgray;
flex: display;
flex-direction: column;
justify-content: center;
justify-items: center;
align-items: center;
align-content: center;
text-align: center;
color: blue;
}
水平居中效果很好。垂直对中有什么不对?您有
flex:display代码>应该是显示:flex代码>
当您进行此调整时,您将看到它符合您的要求