前端

Bootstrap中的弹性布局(flex)

2022-03-22  本文已影响0人  马佳乐
        <div class="d-flex flex-row-reverse border border-dark mt-5 justify-content-center">
            <div class="p-2 border border-success">
                1
            </div>
            <div class="p-2 border border-success">
                2
            </div>
            <div class="p-2 border border-success">
                3
            </div>
        </div>
        <div class="d-flex flex-column-reverse border border-dark mt-5 justify-content-between" style="height: 200px;">
            <div class="p-2 border border-success">
                1
            </div>
            <div class="p-2 border border-success">
                2
            </div>
            <div class="p-2 border border-success">
                3
            </div>
        </div>
        <div class="d-flex  border border-dark mt-5 align-items-baseline" style="height: 200px;">
            <div class="p-2 border border-success align-self-center">
                1
            </div>
            <div class="p-2 border border-success">
                2
            </div>
            <div class="p-2 border border-success">
                3
            </div>
        </div>
        <div class="d-flex flex-row-reverse border border-dark mt-5 justify-content-center">
            <div class="p-2 border border-success">
                1
            </div>
            <div class="p-2 border border-success flex-fill">
                2
            </div>
            <div class="p-2 border border-success">
                3
            </div>
        </div>
        <div class="d-flex flex-row-reverse border border-dark mt-5 justify-content-center">
            <div class="p-2 border border-success">
                1
            </div>
            <div class="p-2 border border-success flex-grow-1">
                2
            </div>
            <div class="p-2 border border-success">
                3
            </div>
        </div>
        <div class="d-flex border border-dark mt-5 justify-content-center">
            <div class="p-2 border border-success w-100">
                1
            </div>
            <div class="p-2 border border-success flex-shrink-1">
                1hello world
            </div>
            <div class="p-2 border border-success">
                2hello world
            </div>
        </div>
        <div class="d-flex border border-dark mt-5 justify-content-center">
            <div class="p-2 border border-success mr-auto">
                1
            </div>
            <div class="p-2 border border-success">
                2
            </div>
            <div class="p-2 border border-success">
                3
            </div>
        </div>
        <div class="d-flex border border-dark mt-5 justify-content-center flex-wrap" style="width: 50px;">
            <div class="p-2 border border-success order-4">
                1
            </div>
            <div class="p-2 border border-success order-3">
                2
            </div>
            <div class="p-2 border border-success order-2">
                3
            </div>
            <div class="p-2 border border-success order-1">
                4
            </div>
        </div>
                <div class="d-flex border border-dark mt-5 flex-wrap align-content-center" style="height: 300px;">
            <div class="p-2 border border-success order-4">
                1
            </div>
            <div class="p-2 border border-success order-3">
                2
            </div>
            <div class="p-2 border border-success order-2">
                3
            </div>
            <div class="p-2 border border-success order-1">
                4
            </div>
        </div>
上一篇下一篇

猜你喜欢

热点阅读