gpt4 book ai didi

css - 如何让我的 div 正确居中

转载 作者:行者123 更新时间:2023-11-28 15:49:38 24 4
gpt4 key购买 nike

我试图让我的内容 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com