-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
实现水平垂直居中的N种方式 #21
Labels
Comments
absolute + margin.container{
position:relative;
}
.content{
position: absolute;
top: 0;
bottom:0;
right:0;
left: 0;
margin:auto;
} |
absolute + transform.container {
position: relative;
}
.content {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
} |
flex.container {
display: flex;
justify-content: center;
align-items: center;
}
.content {
text-align: center;
} |
grid.container {
display: grid;
justify-items: center;
align-items: center;
}
.content {
text-align: center;
} |
css-table.container {
display: table-cell;
text-align: center;
vertical-align: middle;
}
.content{
display: inline-block;
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The text was updated successfully, but these errors were encountered: