css+div 两列并排 容器内显示

.liatmain
{
    width:950px;
    background-color:#ff0000;
    margin:0 auto;
}
.left
{
    float:left;
    width:728px;
}
.right
{
    float:left;
    width:222px;
    background-color:#ffcc00;
}
.clear
{
     clear:both;
}


<div class="liatmain">
        <div class="left">{$MY_首页中部950A}</div>
        <div class="right">{$MY_首页中部950B}</div>
<div class="clear"></div>
</div>

注:float:center,这样的写法是不对的。要让一个层居中,可以写margin:0 auto。我给你加的.clear是为了要清除浮动。兼容浏览器。加了背景,是为了测试

posted on 2009-08-20 00:00  xieguang133  阅读(212)  评论(0)    收藏  举报

导航