如何使文字留在Div?

时间:2011-06-06 17:34:31

标签: html css text

On this site,本文“狗狗坐着让你的狗在你离开的时候,在一个轻松熟悉的环境中待在家里。”应该更高,在照片旁边。

知道如何让文本在图像旁边显示出来吗?

CSS:

#top    {
    height:400px;
    width:1024px;
}
#textright  {
    float:right;
    clear:both;
    width:300px;
}

谢谢,

塔拉

3 个答案:

答案 0 :(得分:1)

float:left添加到狗图像

并将clear:both;添加到ul#list-nav

答案 1 :(得分:1)

这种情况正在发生,因为它漂浮着,而狗图片并没有为它留下任何空间。

如果您将float:left添加到狗图片中,请从#textright中删除width:390px;,然后将clear:bothfloat:left添加到UL,这样做效果很好。

答案 2 :(得分:1)

删除16px边距如下:

div#textright>p:first-child
{
margin-top: 0;
}