关于前端:css使用flex使垂直居中或者水平居中

3次阅读

共计 294 个字符,预计需要花费 1 分钟才能阅读完成。

垂直居中

display: flex;
justify-content: center;
align-items: center;
flex-direction: column;

程度居中

display: flex;
justify-content:space-between;
align-items: center;

display: flex; 弹性盒子由弹性容器
justify-content 属性(程度)对齐弹性容器的我的项目,当我的项目不占用主轴上所有可用空间时。

提醒:请应用 align-items 属性 属性垂直对齐我的项目。
flex-direction: column; 灵便的我的项目将垂直显示,正如一个列一样。

正文完
 0