当我想让我的文本在“块”标签右半部分的左侧距左侧 10 像素处开始时,会发生一些奇怪的事情。当我margin-left: 10px;
突然添加时,我的所有文字都消失了。任何想法是什么原因造成的?我该如何解决这个问题?
HTML:
<div id="container">
<div class="part">
<div class="part halfleft">
<p>
<img alt="" src="src.png" style="width: 469px; height: 371px; " /></p>
</div>
<div class="part halfright">
<h7> Title!</h7>
<p>
Sentence 1</p>
<p>
Sentence 2</p>
<p>
Sentence 3</p>
</div>
</div>
</div>
CSS:
#container {
margin-bottom: 60px;
}
/*….*/
#container h7 {
text-align: left;
width: 100%;
padding-bottom: 15px;
margin-bottom: 35px;
font-size: 30px;
}
#container .part {
width: 960px;
height: 475px;
background-color: #fff;
float: left;
text-align: left;
}
#container .part.halfleft {
width: 480px;
float: left;
font-size: 16px;
}
#container .part.halfright {
width: 480px;
float: left;
padding-top: 30px;
/*margin-left: 10px; or padding-left: 10px; pushes text off screen*/
font-size: 16px;
}