gpt4 book ai didi

html - Div 中的元素不会居中

转载 作者:太空宇宙 更新时间:2023-11-04 13:24:26 24 4
gpt4 key购买 nike

我一直试图将元素置于 div 中,但无济于事。请告诉我我在这里做错了什么。请在下面找到我的 html 和 css 代码:

<div class="one-column-960">
<div class="about1"><a name="about"></a>
<ul>
<li>
<img src="img/team-2.png" alt="" />
<h3>Jose Togbe</h3>
<p class="job-role">Information Architect/ UX Designer</p>
<p>Entrepreneur and CEO of Planmesh by day, information architect and UX designer by night. Jose has worked with various agencies including Oho interactive, O2KL, Revsquare, and ICC Lowe.</p>
</li>
</ul>
</div>
</div><!-- close about us header -->

CSS:

.one-column-960{
width: 100%;
position: relative;
margin: 0 auto;
text-align: center;
}

.about1 ul li {
width: 300px;
display: inline-block;
margin: 0 40px;
padding: 0 20px;
position: absolute;
}

提前致谢!

最佳答案

CSS

.one-column-960{
width: 100%;
position: relative;
margin: 0 auto;
text-align: center;
}

.about1 ul li {
width: 300px;
display: inline-block;
margin: 0 40px;
padding: 0 20px;
/*position: absolute;*/
}

Live Demo

关于html - Div 中的元素不会居中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23832426/

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