使用div+css编写网页框架

使用div+css编写如下网页框架:

在这里插入图片描述
代码:
html文件:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>CSS作业2 </title>
    <link type="text/css" rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="first">
    <div class="red1">

    </div>
    <div class="green1">

    </div>
    <div class="green2">

    </div>
</div>

<div class="second">
    <div class="orange1">

    </div>
    <div class="bluegreen">
        <div class="blue1">

        </div>
        <div class="blue2">

        </div>
        <div class="blue3">

        </div>
        <div class="green3">

        </div>
    </div>

    <div class="pink">

    </div>
</div>
<div class="third">

</div>
</body>
</html>

style.css文件:

body,h1{
    margin:0;
    padding:0;
    color:#fff;
    text-align:center;
}
.first {
    margin: 0 auto;
    background-color:#ffffff;
    width:970px;
    height:103px;
}
.red1{
    background-color:red;
    float: left;
    height:103px;
    width:277px;
}
.green1{
    background-color: lawngreen;
    float: right;
    height: 49px;
    width: 137px;
}
.green2{
    background-color: lawngreen;
    float: right;
    margin-top: 8px;
    height: 46px;
    width: 679px;
}
.second{
    margin-top: 10px;
    margin-left:auto;
    margin-right:auto;
    background-color: #ffffff;
    height: 435px;
    width: 970px;
}
.orange1{
    background-color: orange;
    float:left;
    height: 435px;
    width: 310px;
}
.bluegreen{
    margin-left: 10px;
    float: left;
    background-color:#ffffff;
    width:450px;
    height:435px;
}
.blue1{
    background-color: dodgerblue;
    float: left;
    height: 240px;
    width: 450px;
}
.blue2{
    background-color: dodgerblue;
    float: left;
    margin-top: 10px;
    height: 110px;
    width: 450px;
}
.blue3{
    background-color: dodgerblue;
    float: left;
    margin-top: 10px;
    height: 30px;
    width: 450px;
}
.pink{
    background-color: deeppink;
    margin-left: 10px;
    float:  left;
    height: 400px;
    width: 190px;
}
.green3{
    background-color: seagreen;
    float: left;
    margin-top: 10px;
    height: 25px;
    width: 650px;
}
.third{
    margin-top: 10px;
    margin-left:auto;
    margin-right:auto;
    background-color:darkblue;
    height: 35px;
    width: 970px;
}

运行效果:
在这里插入图片描述

  • 13
    点赞
  • 74
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值