Bootstrap 4.0 Grid System Layout not working

前端 未结 1 1489
时光取名叫无心
时光取名叫无心 2020-11-22 04:07

I\'m trying to do a layout with bootstrap, but I can\'t figure it out what I\'m doing wrong. I\'m putting two columns of 6 and the second column of 6 I\'m putting 2 columns

相关标签:
1条回答
  • 2020-11-22 04:44

    You're just missing a basic Bootstrap "rule". From the docs..

    In a grid layout, content must be placed within columns and only columns may be immediate children of rows.

    In Bootstrap 4, .col- that are not placed in .row will stack vertically.

    https://www.codeply.com/go/GlA3IP7oGU

    <div class="row">
        <div class="col-12 col-sm-12 col-md-6 col-xl-6" style="border-left: solid 1px #ffbfbf;">
            <div style="height: 700px; background-color: #FF3355; border-radius: 15px;">a a a a a a</div>
        </div>
        <div class="col-12 col-sm-12 col-md-6 col-xl-6" style="border-left: solid 1px #ffbfbf;">
            <div class="row">
                <div class="col-12 col-sm-12 col-md-6 col-xl-6" style="padding-right: 0px; padding-left:0px;border-left: solid 1px #ffbfbf;">
                    <div style="height: 320px; background-color: #FF3355; border-radius: 15px;">a</div>
                </div>
                <div class="col-12 col-sm-12 col-md-6 col-xl-6" style="padding-right: 0px; padding-left:0px;border-left: solid 1px #ffbfbf;">
                    <div style="height: 320px; background-color: #FF3355; border-radius: 15px;">a</div>
                </div>
    
                <div class="col-12 col-sm-12 col-md-6 col-xl-6" style="padding-right: 0px; padding-left:0px;border-left: solid 1px #ffbfbf;">
                    <div style="height: 320px; background-color: #FF3355; border-radius: 15px;">a</div>
                </div>
                <div class="col-12 col-sm-12 col-md-6 col-xl-6" style="padding-right: 0px; padding-left:0px;border-left: solid 1px #ffbfbf;">
                    <div style="height: 320px; background-color: #FF3355; border-radius: 15px;">a</div>
                </div>
            </div>
        </div>
    </div>
    

    Read how Bootstrap nesting works


    Related: Wrapping bootstrap columns in extra div

    0 讨论(0)
提交回复
热议问题