BootStrap布局结构 Flex各种布局

本文深入探讨了不同布局结构的设计理念,包括左右结构、上下结构、上中下结构、左中右结构以及组合嵌套结构。通过具体的代码示例,详细解析了每种布局的实现方式及其应用场景。

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

1、左右结构
在这里插入图片描述

<div class="d-flex flex-row" style="width: 500px; height: 400px;border:2px solid #ae00e6">
    <div region="west" class="west" style="width: 140px;">
        西
    </div>
    <div region="center" class="center flex-fill"></div>
</div>

在这里插入图片描述

<div class="d-flex flex-row" style="width: 500px; height: 400px;border:2px solid #ae00e6">
    <div region="center" class="center flex-fill"></div>
    <div region="east" class="east" style="width: 140px;"></div>
</div>

2、上下结构

在这里插入图片描述

<div class="d-flex flex-column" style="width: 500px; height: 400px;border:2px solid #ae00e6">
    <div region="north" class="north" style="height: 80px;"></div>
    <div region="center" class="center flex-fill"></div>
</div>

在这里插入图片描述

<div class="d-flex flex-column" style="width: 500px; height: 400px;border:2px solid #ae00e6">
    <div region="center" class="center flex-fill"></div>
    <div region="south" class="south" style="height: 80px;"></div>
</div>

3、上中下
在这里插入图片描述

<div class="d-flex flex-column" style=" height: 400px;border:2px solid #ae00e6">
    <div region="north" class="north" style="height: 80px;"></div>
    <div region="center" class="center flex-fill"></div>
    <div region="south" class="south" style="height: 80px;"></div>
</div>

4、左中右
在这里插入图片描述

<div class="d-flex flex-row" style=" height: 400px;border:2px solid #ae00e6">
    <div region="west" class="west" style="width: 140px;">
        西
    </div>
    <div region="center" class="center flex-fill"></div>
    <div region="east" class="east" style="width: 140px;"></div>
</div>

5、组合嵌套

在这里插入图片描述

<div class="d-flex flex-row" style="width: 500px; height: 400px;border:2px solid #ae00e6">
    <div region="west" class="west" style="width: 140px;">
        西
    </div>
    <div region="center" class="center flex-fill">
        <div class="d-flex flex-column flex-fill" style="border:1px solid blue;height: 100%;">
            <div region="north" class="north" style="height: 80px;"></div>
            <div region="center" class="center flex-fill"></div>
        </div>
    </div>
</div>

在这里插入图片描述

<div class="d-flex flex-row" style="width: 500px; height: 400px;border:2px solid #ae00e6">
    <div region="center" class="center flex-fill">
        <div class="d-flex flex-column flex-fill" style="border:1px solid blue;height: 100%;">
            <div region="center" class="center flex-fill"></div>
            <div region="south" class="south" style="height: 80px;"></div>
        </div>
    </div>
    <div region="east" class="east" style="width: 140px;"></div>
</div>

在这里插入图片描述

<div class="d-flex flex-row" style="width: 500px; height: 400px;border:2px solid #ae00e6">
    <div region="center" class="center flex-fill">
        <div class="d-flex flex-column flex-fill" style="border:1px solid blue;height: 100%;">
            <div region="north" class="north" style="height: 80px;"></div>
            <div region="center" class="center flex-fill"></div>
            <div region="south" class="south" style="height: 80px;"></div>
        </div>
    </div>
    <div region="east" class="east" style="width: 140px;"></div>
</div>

在这里插入图片描述

<div class="d-flex flex-row" style="width: 500px; height: 400px;border:2px solid #ae00e6">
    <div region="west" class="west" style="width: 140px;">
        西
    </div>
    <div region="center" class="center flex-fill">
        <div class="d-flex flex-column flex-fill" style="border:1px solid blue;height: 100%;">
            <div region="north" class="north" style="height: 80px;"></div>
            <div region="center" class="center flex-fill"></div>
            <div region="south" class="south" style="height: 80px;"></div>
        </div>
    </div>
</div>

在这里插入图片描述

<div class="d-flex flex-column" style=" height: 400px;border:2px solid #ae00e6">
    <div region="north" class="north" style="height: 80px;"></div>
    <div region="center" class="center flex-fill d-flex flex-column">
        <div class="d-flex flex-row flex-fill" style=" height: 100%;border:1px solid blue">
            <div region="west" class="west" style="width: 140px;">
                西
            </div>
            <div region="center" class="center flex-fill"></div>
            <div region="east" class="east" style="width: 140px;"></div>
        </div>
    </div>
    <div region="south" class="south" style="height: 80px;"></div>
</div>

在这里插入图片描述

<div class="d-flex flex-column" style=" height: 400px;border:2px solid #ae00e6">
    <div region="center" class="center flex-fill d-flex flex-column">
        <div class="d-flex flex-row flex-fill" style=" height: 100%;border:1px solid blue">
            <div region="west" class="west" style="width: 140px;">
                西
            </div>
            <div region="center" class="center flex-fill"></div>
            <div region="east" class="east" style="width: 140px;"></div>
        </div>
    </div>
    <div region="south" class="south" style="height: 80px;"></div>
</div>

在这里插入图片描述

<div class="d-flex flex-column" style=" height: 400px;border:2px solid #ae00e6">
    <div region="north" class="north" style="height: 80px;"></div>
    <div region="center" class="center flex-fill d-flex flex-column">
        <div class="d-flex flex-row flex-fill" style=" height: 100%;border:1px solid blue">
            <div region="west" class="west" style="width: 140px;">
                西
            </div>
            <div region="center" class="center flex-fill"></div>
            <div region="east" class="east" style="width: 140px;"></div>
        </div>
    </div>
</div>

在这里插入图片描述

<div class="d-flex flex-column" style=" height: 400px;border:2px solid #ae00e6">
    <div region="north" class="north" style="height: 80px;"></div>
    <div region="center" class="center flex-fill d-flex flex-column">
        <div class="d-flex flex-row flex-fill" style=" height: 100%;border:1px solid blue">
            <div region="center" class="center flex-fill"></div>
            <div region="east" class="east" style="width: 140px;"></div>
        </div>
    </div>
    <div region="south" class="south" style="height: 80px;"></div>
</div>

原文链接:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值