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

垂直居中

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;灵便的我的项目将垂直显示,正如一个列一样。

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理