Skip to content

垂直居中效果不一致 #4

@linjiaqin12138

Description

@linjiaqin12138

第二章“垂直居中”的第四个小节“单个块级元素”的第三点“使用flex实现”中

#parent{
    display: flex;
    align-items: center;
}

//或

#parent{display: flex;}
.son{align-self: center;}

效果如下
image

#parent{
    display: flex;
    flex-direction: column;
    justify-content: center;
}

效果如下
image
效果不一致,后者才是正确的

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions