你很接近,當你使用div時,你必須小心你把什麼放在外部div上,因爲它們也適用於內部div,所以你想要的是這樣的:
#right_col {
width:260px;
/* padding:5px; */
background-color:#999900;
float:left;
line-height:18px;
font-size:12px; color:#FFFFFF; text-align:justify
}
#heading
{
font-size:16px;
color:#FFFFFF;
padding:10px;
background-color:#030;
display:block;
}
.content {
padding:7px;
}
和添加內容div來從文本的標題分開:
<div id="right_col">
<strong id="heading">QUAID'S MESSAGE</strong>
<div class="content">
<img src="images/quaid-2.jpg" align="left" style="margin-right:5px; border: 1px solid #006600; "/> "Pakistan is proud of her youth, particularly the students, who are nation builders of tomorrow. They must fully equip themselves by discipline, education, and training for the arduous task lying ahead of them."
</div>
</div>
小提琴繼承人:http://jsfiddle.net/8vpyk815/2/
,你也應小心,所有的第e隨機填充會導致他們可以使用其他元素內部的元素難以工作
請將代碼直接添加到問題以及JSFiddle的鏈接。 – Brian
http://jsfiddle.net/8vpyk815/1/ –
除了支持基於'table'的佈局,我可能會建議使用標題標籤'h1,h2,h3'等,而不是'strong'標籤並且不要使用「align」屬性來對齊網頁的元素。 – hungerstar