如何向已经浮动的文本添加padding-left?

时间:2014-07-10 23:54:48

标签: html css html5 css3

链接:http://neilson.webege.com/principals.html

我想在图片和文字之间添加10px的填充。

该文本目前正在浮动。当我试图将padding-left放在其中一个P类中时,没有任何改变。

任何提示?

<div class="eachprincipal">
<img src="images/principalpic.jpg" style="float:left;padding-right: 10px;">
<br>
<br>
<p style="float:right">
</p><p class="principalname"> Jack Zakariaie, J.D. </p>
<br>
<p class="principaldescription"> Jack of the house Zakariaie, the First of his Name, King of the Andals and the Rhoynar and the First Men, Lord of the Seven Kingdoms and Protector of the Realm has fed all the starving children in the world by causing photosynthesis in farm plants by reflecting light off his bald head.</p><p></p>
</div>

1 个答案:

答案 0 :(得分:1)

你当前的方式,填充应该添加到图像,而不是段落。

.eachprincipal > img {
    padding-right: 10px;
}