CSS:Div Positioning ...帮助

时间:2010-10-27 18:08:41

标签: css html

看看这个Code。我想要左派和左派右框(DIV)出现在一行中......怎么做

2 个答案:

答案 0 :(得分:1)

<div><div style="float:left">a</div> <div style="float:left">b</div></div>
<div style="clear:both"></div>

答案 1 :(得分:0)

向左和向左浮动div并清除页脚。您还需要调整左右div的宽度,使它们适合同一条线。

#left
{
    position:static;
    width: 40%;
    height: 50px;
    margin-top: 10px;
    margin-right: 10px;
    background: #111111;
    border: solid 3px #ff0000; 
    float: left;
}

#right
{
    position:static;
    width: 40%;
    height: 50px;
    margin-top: 10px;
    margin-right: 10px;
    background: #111111;
    border: solid 3px #ff0000;
    float: left;
}

#footer
{
    position: static;
    width   : 100%;
    height  : 50px;
    margin-top: 10px;

    background: #111111;
    border: solid 3px #ff0000;
    text-align: center;
    clear: both;
}