我试图将此段落放在标题(h4)下。两者都向左浮动,文本向左对齐。但是,它仍然最终居中。我们(我们的团队)进行了测试,而标签不是问题。
<center><div id="content">
<!-- <p>hi.</p> -->
<div class="postStarter">
</div>
<div class="post">
<img src="person.png" class="avatar-entry"><a href="profiles/2-thomas"><h4 class="postAuthor">Ranger Thomas A.</h4></a>
<br />
<br />
<p class="postText">UNIX-BASED.</p>
</div>
<div class="post">
<img src="person.png" class="avatar-entry"><a href="profiles/2-thomas"><h4 class="postAuthor">Ranger Thomas A.</h4></a>
<br />
<br />
<p class="postText">Living the Mac life.</p>
</div>
</div>
这是CSS:
.postStarter {
background: #FFF;
border-bottom: 1px solid #E0E0E0;
width: 500px;
height: 100px;
}
.post {
background: #FFF;
border-bottom: 1px solid #E0E0E0;
width: 500px;
height: 100px;
}
.postText {
float: left;
text-align: left;
}
#content {
width: 1000px;
height: 900px;
background: #FFF;
border-left: 1px solid #E0E0E0;
border-right: 1px solid #E0E0E0;
border-top: .5px solid #FFF;
border-bottom: none;
}
有想法该怎么解决这个吗?
http://i.redsroom.info/npPO。
最佳答案
尝试在che“ p”标记之前放置“ clear div”,如下所示:
<div class="post">
<img src="person.png" class="avatar-entry"><a href="profiles/2-thomas"><h4 class="postAuthor">Ranger Thomas A.</h4></a>
<br />
<div class="clear"></div>
<p class="postText">UNIX-BASED.</p>