Java教程

如何让一个层垂直居中

本文主要是介绍如何让一个层垂直居中,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!


如何让一个层垂直居中

position: absolute;
top: 50%;
left: 50%;

如何让一个层向上垂直居中

position: absolute;
top: 50%;
left: 50%;
display: flex;
align-items: center;
justify-content: center;
width: 150px;
height: 150px;
margin-top: -75px;
margin-left: -75px;
background: white;
border-radius: 16px;

 

这篇关于如何让一个层垂直居中的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!