页面作业练习

本文通过一个实战案例展示了如何使用HTML和CSS实现复杂网页布局。该案例包括多个区块的浮动布局、清除浮动及背景颜色设置等技巧。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>页面作业</title>
    <style>
        .cleanfix:after{
            content: "";
            display: table;
            clear: both;
        }
        #left,#left2,#center,#right{
            float: left;
        }
        #top1,#top2{
            float: left;
        }
        #left{
            width: 20%;
            height: 300px;
            background-color: #FF6500;

        }
        #left2{
            width: 20%;
            height: 300px;
            background-color: aqua;
        }
        #left21{
            width: 100%;
            height: 50%;
            background-color: antiquewhite;

        }
        #left22{
            width: 100%;
            height: 50%;
            background-color: blue;
        }
        #center{
            width: 20%;
            height: 300px;
            background-color: blueviolet;
        }
        #right{
            width: 40%;
            height: 300px;
            background-color: aqua;
        }
    #top{
            height: 50%;
            width: 100%;
            background-color: #19242C;
        }
        #bottom{
            height: 50%;
            width: 100%;


        }
        #top1{
            width: 50%;
            height:100%;
            background-color: #cccccc;
        }
        #top2{
            width: 50%;
            height:100%;
            background-color: burlywood;
        }
        #bottom{
            width: 100%;
            height: 50%;
            background-color: #FF7100;
        }
    </style>
</head>
<body>
<div class="cleanfix">
    <div id="left"></div>
    <div id="left2" class="cleanfix" >
        <div id="left21"></div>
        <div id="left22"></div>
    </div>
    <div id="center"></div>
    <div id="right">
        <div id="top" class="cleanfix">
            <div id="top1"></div>
            <div id="top2"></div>
        </div>
        <div id="bottom"></div>
    </div>
</div>
<div style="background-color: antiquewhite ;border: 5px solid red ">
    123
</div>
</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值