问答详情
源自:2-6 编程练习

求师傅们帮忙看看哪里错了,不出效果

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTG-8" />
<title>无标题文档</title>
<style type="text/css">

/*在此定义相应的类选择器,并根据要求设置相关CSS属性*/
*{
    padding:0;
    margin:0;
}

.mainBox{
    width:960px;
    height:300px;
    background:#CFF;
    margin:0 auto;
    overflow:visible;
};

.leftBox{
    width:740px;
    height:300px;
    background:#C9F;
    float:left;
    
};

.rightBox{
    width:210px;
    height:300px;
    background:#FCF;
    float:right;
   
};

.clear{
    clear:both;
    height:0;
    overflow:hidden;
}
</style>
</head>

<body>
<div class="mainBox">
    <div class="leftBox">Box1</div>
    <div class="rightBox">Box2</div>
    <div class="clear"></div>
</div>




</body>
</html>

提问者:qq_悠悠我心_4 2016-06-19 16:41

个回答

  • qq_尼古拉斯_03383090
    2016-06-19 19:59:01
    已采纳

    *{

        padding:0;

        margin:0;

    }


    .mainBox{

        width:960px;

        height:300px;

        background:#CFF;

        margin:0 auto;

        overflow:visible;

    }


    .leftBox{

        width:740px;

        height:300px;

        background:#C9F;

        float:left;

        

    }


    .rightBox{

        width:210px;

        height:300px;

        background:#FCF;

        float:right;

       

    }


    .clear{

        clear:both;

        height:0;

        overflow:hidden;

    }


  • 慕移动9181930
    2022-03-25 02:58:28

    原来是这样哇嘿嘿

  • 慕粉3336516
    2016-06-19 20:26:11

    .mainBox{
        width:960px;
        height:300px;
        background:#CFF;
        margin:0 auto;
        overflow:visible;
    };

    .leftBox{
        width:740px;
        height:300px;
        background:#C9F;
        float:left;    
    };

    .rightBox{
        width:210px;
        height:300px;
        background:#FCF;
        float:right;   
    };

    样式表最后多加了个分号;

  • 慕粉3336516
    2016-06-19 20:18:32

    "charset=UTG-8"应为"utf-8"

    里面的overflow也不用设置吧