无法正确放置<div> </div>

时间:2013-07-07 17:23:22

标签: css html

我正在尝试创建这样的部门:

Layout http://img593.imageshack.us/img593/5742/nf5l.png

前三个很好用,它只是创建问题的页脚。

#banner
    {
    background: url(image.gif) repeat-x;
    display:block;
    width:100%;
    height:340px;
    }
.container
    {
    width:960px;
    margin: 0 auto;
    height:960px;
    clear:both;
    background-color:#000;
    }

.left-container 
    {
    width:55.72916%;
    float:left;
    }
.right-container    
    {
    text-align:center;
    width:44%;
    float:right;
    padding-top:25px;
    }

banner指的是黑色的第一个div ..

现在我应该如何设置页脚div的样式,因为当我输入一些信息时,它会出现在横幅div下方并与左右容器重叠。

和...

每当我使用<p>标签并指定一些字体大小时,为什么它会自动将margin-top和bottom等于font-size ..它的属性是什么?

2 个答案:

答案 0 :(得分:0)

您的问题尚不完整,但您的页脚元素上看起来需要clear:both

答案 1 :(得分:0)

首先问题在这里尚不清楚,

以避免overlapping with left and right container. (我猜绿框指的是这些)

如果你想让页脚矩形看起来像标题(我猜黑盒子).u可能需要在绿色矩形中使用overflow:hidden;或在页脚div上使用clear:both;

以避免it's appearing just below banner div (我猜横幅意味着黑匣子)

在页脚中使用margin-top:50px;(例如)与标题

建立距离