我试图让我的内容 div 居中,但使用当前方法它是在右边而不是死点。
#content {
width: 620px;
height: 2000px;
position:absolute;
top: 300px;
left:50%;
margin-right: 310px;
background-color: #0F0;
padding: 0;
margin: 0px;
}
最佳答案
你应该使用 margin: 0 auto;
with width;然后它将位于其父项的中心。
关于css - 如何让我的 div 正确居中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15838124/