CSS,两个DIV怎样左浮动,名为3的DIV中有两个DIV,1和2,怎样在同一行中左浮动?

.3{ background-color: #999;height:600px auto;width: 760px;}
.1,.2{ float:left; }
.1{width:211px; height:123px; background:#036; }
.2{width:324px;background:#0ff; height: 210px;}

我上面的CSS不能同一行??

    class不能使用纯数字,你这里用了1、2、3这显然是错误的;

    height:600px auto;属性值错误的。高度要么600px,要么auto;没有连个值一起用的用法;

    .1,.2同时声明多个class,逗号后面要加空格;

    background-color: #999;采用通用写法,既然后面都用了background前面为什么要用background-color: #999;呢;


我给你改了一下你的代码:如下css:

.div3{ background:#999;height:600px;width: 760px;}
.div1, .div2{ float:left; }
.div1{width:211px; height:123px; background:#036; }
.div2{width:324px;background:#0ff; height: 210px;}

html:

<div class="div3">
<div class="div1">div1</div>
    <div class="div2">div2</div>
</div>

温馨提示:答案为网友推荐,仅供参考

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网