布局的使用

<style>
        *{
            margin: 0;
            padding: 0;
        }
        html,body{
            height: 100%;
        }
        .box1{
            width: 100%;
            height: 50px;
            background-color: red;
        }
        .box2{
            width: 100%;
            height: auto;
        }
        .box3{
            width: 100%;
            height: 50px;
            background-color: green;
        }
        .box4{
            width: 200px;
            height: 100%;
            min-height: 500px;
            background-color: black;
            float: left;
        }
        .box5{
            width: 200px;
            height: 100%;
            min-height: 500px;
            background-color: blue;
            float: right;
        }
        .box6{
            width: calc(100%-400px);
            height: 100%;
            min-height: 500px;
            background-color: gold;
        }
    </style>
</head>
<body>
    <div class="box1">
        123000
    </div>
    <div class="box2">
        <div class="box4"></div>
        <div class="box5"></div>
        <div class="box6"></div>
    </div>
    <div class="box3">
        789
    </div>

布局1

两栏布局方法一

    <style>
        *{
            margin: 0;
            padding: 0;
        }
        html,body{
            height: 100%;
        }
        .box1{
            width: 200px;
            height: 100%;
            background-color: red;
            float: left;
        }
        .box2{
            width: auto;
            height: 100%;
            background-color: yellow;
            margin-left: 200px;
        }
    </style>

两栏布局方法二

<style>
        *{
            margin: 0;
            padding: 0;
        }
        html,body{
            height: 100%;
        }
        .box1{
            width: 200px;
            height: 100%;
            background-color: red;
            float: left;
        }
        .box2{
            width: calc(100%-200px);
            height: 100%;
            background-color: yellow;
        }
    </style>

在这里插入图片描述
三栏布局

    <style>
        *{
            margin: 0;
            padding: 0;
        }
        html,body{
            height: 100%;
        }
        .box1{
            width: 200px;
            height: 100%;
            background-color: red;
            float: left;
        }
        .box3{
            width: calc(100%-400px);
            height: 100%;
            background-color: yellow;
        }
        .box2{
            width: 200px;
            height: 100%;
            background-color: green;
            float: right;
        }

    </style>

</head>
<body>
    <div class="box1">
        123000
    </div>
    <div class="box2">
        789
    </div>
    <div class="box3">
        789
    </div>

在这里插入图片描述

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值