我希望有一个div可以垂直和水平居中,即在页面的中心。我尝试使用position: absolute并将div的top、right、bottom、left设置为0!但问题是当我放大页面时它会与其他标题和div重叠!请帮助我!如何在不重叠其他div的情况下将div定位在页面中心?
就像我尝试过的:
就像我尝试过的:
.center{
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
}
auto
。 - Rishabh Mishra